Fix SCEV cache invalidation in LCSSA and LoopSimplify.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 26 Oct 2012 17:31:43 +0000 (17:31 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 26 Oct 2012 17:31:43 +0000 (17:31 +0000)
commitb2b2273ef4b67b7da4c05472095b8b96cc04ca8d
treea082202eacbbc82ca8ab1ec7e7dade1b5eb3f6b7
parentff18310274e872429cd06d679b1c8c8a14166328
Fix SCEV cache invalidation in LCSSA and LoopSimplify.

The LoopSimplify bug is pretty harmless because the loop goes from unanalyzable
to analyzable but the LCSSA bug is very nasty. It only comes into play with a
specific order of the LoopPassManager worklist and can cause actual
miscompilations, when a SCEV refers to a value that has been replaced with PHI
node. SCEVExpander may then insert code into the wrong place, either violating
domination or randomly miscompiling stuff.

Comes with an extensive test case reduced from the test-suite with
bugpoint+SCEVValidator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166787 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LCSSA.cpp
lib/Transforms/Utils/LoopSimplify.cpp
test/Transforms/IndVarSimplify/verify-scev.ll [new file with mode: 0644]