[LLVMdev] value tracking (original) (raw)

陳韋任 chenwj.cs97g+llvmdev at g2.nctu.edu.tw
Wed Feb 4 17:37:57 PST 2015


Hi Xin Tong,

On Thu, Feb 5, 2015 at 7:46 AM, Xin Tong <trent.tong at gmail.com> wrote:

I would like to know what API i can use to tell that x cant be negative. I looked through the value tracking analysis API, nothing seems immediate.

int divBy4(int x) { if (x < 0) abort(); return x/4; } http://llvm.org/docs/doxygen/html/ValueTracking8h.html

How about llvm::ComputeSignBit? I think you can tell it's negative by the sign bit, right?

Regards, chenwj



More information about the llvm-dev mailing list