OSDN Git Service

[IndVars] Fix a bug introduced in r317012
authorPhilip Reames <listmail@philipreames.com>
Fri, 1 Dec 2017 20:57:19 +0000 (20:57 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 1 Dec 2017 20:57:19 +0000 (20:57 +0000)
commit0fed3ad4cb880f52a5385d695ac7367c074c09c5
tree1e7e4a5c5f8ff1209a2315224b8893d3c22c93e0
parent8ad3e8644f2195d9109b2c91fb82a8ef8347c4c0
[IndVars] Fix a bug introduced in r317012

Turns out we can have comparisons which are indirect users of the induction variable that we can make invariant.  In this case, there is no loop invariant value contributing and we'd fail an assert.

The test case was found by a java fuzzer and reduced.  It's a real cornercase.  You have to have a static loop which we've already proven only executes once, but haven't broken the backedge on, and an inner phi whose result can be constant folded by SCEV using exit count reasoning but not proven by isKnownPredicate.  To my knowledge, only the fuzzer has hit this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319583 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyIndVar.cpp
test/Transforms/IndVarSimplify/loop-invariant-conditions.ll