[llvm-dev] add/sub instructions

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 16 08:30:28 PDT 2017


On 8/16/17 5:44 AM, Anastasiya Ruzhanskaya via llvm-dev wrote:
> Hello,
> I found out recently, that when I have j-- pattern in cycle it is 
> written in llvm code with the help of addition. I actually wanted to 
> somehow check are we following descending or acceding pattern in 
> cycle. Is this substitution of operations done always? or not? seems 
> that in this case the only way to proceed is to check whether the 
> operand is negative or not.

If you're writing an LLVM analysis pass, then it should (ideally) handle 
any LLVM IR that can express the computation.  If you are writing an 
analysis pass that determines whether a value is increasing or 
decreasing, then your code should consider both add and sub 
instructions.  You should also consider integer overflow and how your 
analysis should handle the possibility that an increment will underflow 
or overflow an integer value and whether that result is defined or 
undefined based on the flags of the add/sub instructions.

You might want to look at the ScalarEvolution pass.  I think it may do 
some of the analysis that you want to do.

Regards,

John Criswell


>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170816/5fb1a828/attachment.html>


More information about the llvm-dev mailing list