[PATCH] D16570: [IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader
Chen Li via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 25 22:01:52 PST 2016
chenli created this revision.
chenli added a reviewer: sanjoy.
chenli added a subscriber: llvm-commits.
This is a revised version of D13974.
D13974 was committed but failed one lnt test. The bug was that we only checked the condition from loop exit's incoming block was a loop invariant. But there could be another condition from loop header to that incoming block not being a loop invariant. This would produce miscompiled code.
This patch fixes the issue by checking if the incoming block is loop header, and if not, don't perform the rewrite. The could be further improved by recursively checking all conditions leading to loop exit block, but I'd like to check in this simple version first and improve it with future patches.
http://reviews.llvm.org/D16570
Files:
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/rewrite-loop-exit-value.ll
test/Transforms/LoopUnroll/scevunroll.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16570.45947.patch
Type: text/x-patch
Size: 6698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160126/0f79ccf7/attachment.bin>
More information about the llvm-commits
mailing list