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/ValueTracking_8h.html Thanks, Trent -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150204/019732e7/attachment.html>
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/ValueTracking_8h.htmlHow about llvm::ComputeSignBit? I think you can tell it's negative by the sign bit, right? Regards, chenwj