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)
commite3d821a4664bc793a32166eb5ea9319c70ee7f9a
treef0f48b23b436e6720541c3c815ed8b52e3c22156
parent214935ee70c26fca2a0d6c4916aaebe0de9d3e7f
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.

llvm-svn: 166787
llvm/lib/Transforms/Utils/LCSSA.cpp
llvm/lib/Transforms/Utils/LoopSimplify.cpp
llvm/test/Transforms/IndVarSimplify/verify-scev.ll [new file with mode: 0644]