[PATCH] D26059: [IndVars] Change the order to compute WidenAddRec in widenIVUse
Wei Mi via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 13:53:53 PST 2016
wmi updated this revision to Diff 77546.
wmi added a comment.
Add zext to the iv-widen.ll test.
I still need to update iv-widen-elim-ext.ll. Now SE->isKnownPredicate return false for "%add = add nsw i32 %i.02, 2" in foo because %add feeds into zext and zext doesn't propagate full poison, so the nsw flag cannot be copied from IR to SCEV. As a result, NarrowIVDefUse::NeverNegative for %add is false and my change here will generate an extra trunc before zext. The fact that existing compiler doesn't generate the extra trunc is by luck to some extent.
I update the test to add another use for %add: "udiv 5, %add", which is to ensure %add is not poison otherwise there will be undefine behavior, and ensure that nsw flag on %add instruction can be copied to its SCEV, so that NarrowIVDefUse::NeverNegative for %add will be true.
After the test update, w/wo the change here, indvars will not generate extra trunc for sext/zext for foo in the testcase.
Repository:
rL LLVM
https://reviews.llvm.org/D26059
Files:
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/iv-widen-elim-ext.ll
test/Transforms/IndVarSimplify/iv-widen.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26059.77546.patch
Type: text/x-patch
Size: 4630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161110/f1c3e965/attachment.bin>
More information about the llvm-commits
mailing list