matthieu at illinois.edu
2008-Aug-22 20:10 UTC
[LLVMdev] Conditonal to constant promotion?
Hi, I tried the memory dependency analysis posted by Wojciech on the attached test case. The analysis had to fallback to conservatives answers sometimes, probably (but not sure) due to the existence of several select instructions that might prevent the analysis from correctly find the answer. In this specific test case, these selects are provably useless and I am trying to get rid of them either by finding the correct transformation pass or writing/extending an existing one. The instructions I am referring to are in the basic block bb.nph15.split: bb.nph15.split: ; preds = %bb.nph15 %umax26 = select i1 %0, i32 1, i32 %m ; <i32> [#uses=2] %umax22 = select i1 %15, i32 1, i32 %o ; <i32> [#uses=2] %umax = select i1 %16, i32 1, i32 %n ; <i32> [#uses=1] br i1 %16, label %bb.nph15.split.bb5.preheader.us_crit_edge, label %bb.nph15.split.bb5.preheader_crit_edge This block has only one predecessor: bb.nph15: ; preds = %entry icmp eq i32 %o, 0 ; <i1>:15 [#uses=2] icmp eq i32 %n, 0 ; <i1>:16 [#uses=2] br i1 %15, label %bb.nph15.return_crit_edge, label %bb.nph15.split For instance, %umax22 is provably equal to %o, as the conditional used by select (%15) is the same as the one used by the conditional branch that brought us there. I tried sccp, condprop and constprop and none of them seems to handle this case. Is there one? Matthieu Delahaye -------------- next part -------------- A non-text attachment was scrubbed... Name: testcase.ll Type: application/octet-stream Size: 5272 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080822/7f53ea90/attachment.obj>
On Fri, Aug 22, 2008 at 1:10 PM, <matthieu at illinois.edu> wrote:> Hi, > > I tried the memory dependency analysis posted by > Wojciech on the attached test case. The analysis > had to fallback to conservatives answers sometimes, > probably (but not sure) due to the existence of several > select instructions that might prevent the analysis > from correctly find the answer. > > In this specific test case, these selects are provably > useless and I am trying to get rid of them either by finding > the correct transformation pass or writing/extending an existing > one.Have you tried -predsimplify? -Eli