Hi all, I am trying to see how single llvm optimizations work by running them one by one with opt and looking how the IR changes.Since I was interested in seeing how constant propagation was working I tried to run opt on the Sparse Conditional Constant Propagation, however by passing as argument -S -sccp -die it does not change anything in the output IR code. I attached the file with the source code I used, I think that the x value in that example should be propagated in the mul instruction. What am I missing? Thank you in advance, Niko -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130416/a91407c3/attachment.html> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: code.c URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130416/a91407c3/attachment.c> -------------- next part -------------- A non-text attachment was scrubbed... Name: code.s Type: text/x-asm Size: 1441 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130416/a91407c3/attachment.bin>
This compiler does not have mem-SSA, as far as I know, only few pass can propagate value along memory. You need to promote those local variable into register first before sccp is invoked. e.g1. opt a.ll -basicaa -gvn -sccp -S eg.2. opt a.ll -sroa -sccp -S On 4/16/13 12:37 PM, Niko Zarzani wrote:> Hi all, > > I am trying to see how single llvm optimizations work by running them > one by one with opt and looking how the IR changes. > Since I was interested in seeing how constant propagation was working > I tried to run opt on the Sparse Conditional Constant Propagation, > however by passing as argument -S -sccp -die it does not change > anything in the output IR code. I attached the file with the source > code I used, I think that the x value in that example should be > propagated in the mul instruction. What am I missing? > > Thank you in advance, > > Niko > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130416/72ff4d2a/attachment.html>
Right reason, but you want mem2reg. Without mem2reg, i would not expect most passes to do anything. opt a.ll -mem2reg -sccp gives the result you want. On Tue, Apr 16, 2013 at 12:57 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:> This compiler does not have mem-SSA, as far as I know, only few pass can > propagate value along memory. > > You need to promote those local variable into register first before sccp is > invoked. > e.g1. opt a.ll -basicaa -gvn -sccp -S > eg.2. opt a.ll -sroa -sccp -S > > > On 4/16/13 12:37 PM, Niko Zarzani wrote: > > Hi all, > > I am trying to see how single llvm optimizations work by running them one by > one with opt and looking how the IR changes. > Since I was interested in seeing how constant propagation was working I > tried to run opt on the Sparse Conditional Constant Propagation, however by > passing as argument -S -sccp -die it does not change anything in the output > IR code. I attached the file with the source code I used, I think that the x > value in that example should be propagated in the mul instruction. What am I > missing? > > Thank you in advance, > > Niko > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >