[PATCH] D24651: [SCEV] Try harder to find UB for NSW/NUW instr
Christof Douma via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 16 03:09:25 PDT 2016
christof created this revision.
christof added reviewers: broune, sanjoy, sbaranga.
christof added a subscriber: llvm-commits.
christof set the repository for this revision to rL LLVM.
Herald added subscribers: mzolotukhin, mehdi_amini, sanjoy.
Extended UB analysis of SCEV with the case where an instruction marked as non-wrapping (I) is later used in a latch control expression. In this case, if I holds a poison value, the loop can be made to iterate forever which is undefined behavior.
For wrapping of I to be UB, the latch control expression must execute if I is executed. To proof this, the PostDominatorTree is needed by SCEV. If a post-domination path is found, it is checked that progress from I to the latch control expression is guaranteed. That is, trapping instruction and infinite loops must be absent on that execution path.
This patch is 1/2 to fix PR28429. Known issues:
- Contains a work around for the LoopPassManager that has trouble with the newly added dependency of the PostDominator pass. This can be approved upon to make the PostDominatorTree pass run less often
- LoopUnroll uses SCEV and breaks PostDominatorTree, giving an segfault if a function contains multiple loops.
I hope to get a review to see if this work is OK to commit once the known issues listed above are fixed.
Repository:
rL LLVM
https://reviews.llvm.org/D24651
Files:
include/llvm/Analysis/ScalarEvolution.h
include/llvm/Analysis/ValueTracking.h
lib/Analysis/LoopPassManager.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Analysis/ValueTracking.cpp
lib/Transforms/Utils/LoopUtils.cpp
test/Analysis/ScalarEvolution/flags-from-poison.ll
test/Analysis/ScalarEvolution/trip-count12.ll
test/Analysis/ScalarEvolution/trip-count9.ll
test/Other/pass-pipelines.ll
test/Transforms/SLPVectorizer/X86/consecutive-access.ll
unittests/Analysis/ScalarEvolutionTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24651.71604.patch
Type: text/x-patch
Size: 23937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160916/2dcb4985/attachment.bin>
More information about the llvm-commits
mailing list