yunming zhang
2013-Mar-28 02:15 UTC
[LLVMdev] Question about simple constant propagation pass
Hi, I just started working with llvm, I am trying to test and improve the constant propagation pass (-constprop), I have two main questions, 1. I wrote my own test file, which has something like int a = 1 int b = a + 2; int c = b + 3; print c However, non of the instruction was killed according to -stat. I think it might due to the fact the llvm instructions generated was a bit convoluted, but overall, I am not sure why this simple test case has no instruction killed? Shouldn't c be just 6 and show at least two instructions killed? 2. The description states that this pass is very simple. Can anyone point me to a few directions that might be interesting to improve it? I am not sure about why is it labeled "simple" ? Thanks Yunming -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130327/b2f5a295/attachment.html>
Duncan Sands
2013-Mar-28 12:11 UTC
[LLVMdev] Question about simple constant propagation pass
Hi Yunming, On 28/03/13 03:15, yunming zhang wrote:> Hi, > > I just started working with llvm, I am trying to test and improve the constant > propagation pass (-constprop), > > I have two main questions, > > 1. I wrote my own test file, which has something like > int a = 1 > int b = a + 2; > int c = b + 3; > print c > > However, non of the instruction was killed according to -stat. I think it > might due to the fact the llvm instructions generated was a bit convoluted, but > overall, I am not sure why this simple test case has no instruction killed? > Shouldn't c be just 6 and show at least two instructions killed?optimization passes usually assume you have run at least -mem2reg (or -sroa) first and won't do much if you haven't. Ciao, Duncan.> > 2. The description states that this pass is very simple. Can anyone point me to > a few directions that might be interesting to improve it? I am not sure about > why is it labeled "simple" ? > > Thanks > > Yunming > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
yunming zhang
2013-Mar-28 16:24 UTC
[LLVMdev] Question about simple constant propagation pass
Thanks a lot Duncan!! It worked like magic, Yunming On Thu, Mar 28, 2013 at 7:11 AM, Duncan Sands <baldrick at free.fr> wrote:> Hi Yunming, > > > On 28/03/13 03:15, yunming zhang wrote: > >> Hi, >> >> I just started working with llvm, I am trying to test and improve the >> constant >> propagation pass (-constprop), >> >> I have two main questions, >> >> 1. I wrote my own test file, which has something like >> int a = 1 >> int b = a + 2; >> int c = b + 3; >> print c >> >> However, non of the instruction was killed according to -stat. I >> think it >> might due to the fact the llvm instructions generated was a bit >> convoluted, but >> overall, I am not sure why this simple test case has no instruction >> killed? >> Shouldn't c be just 6 and show at least two instructions killed? >> > > optimization passes usually assume you have run at least -mem2reg (or > -sroa) > first and won't do much if you haven't. > > Ciao, Duncan. > > >> 2. The description states that this pass is very simple. Can anyone point >> me to >> a few directions that might be interesting to improve it? I am not sure >> about >> why is it labeled "simple" ? >> >> Thanks >> >> Yunming >> >> >> ______________________________**_________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<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<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130328/6d4a0db8/attachment.html>