forked from OSchip/llvm-project
[SCEV] Take correct loop in AddRec simplification. PR40420
The code of AddRec simplification is using wrong loop when it creates a new AddRecExpr. It should be using AddRecLoop which we have saved and against which all gate checks are made, and not calling AddRec->getLoop() over and over again because AddRec may change and become an AddRecurrency from outer loop during the transform iterations. Considering this change trivial, commiting for postcommit review. llvm-svn: 352451
This commit is contained in:
parent
d4de606ddb
commit
468ad52213
|
@ -3089,7 +3089,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||||
AddRecOps.push_back(getAddExpr(SumOps, SCEV::FlagAnyWrap, Depth + 1));
|
AddRecOps.push_back(getAddExpr(SumOps, SCEV::FlagAnyWrap, Depth + 1));
|
||||||
}
|
}
|
||||||
if (!Overflow) {
|
if (!Overflow) {
|
||||||
const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(),
|
const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRecLoop,
|
||||||
SCEV::FlagAnyWrap);
|
SCEV::FlagAnyWrap);
|
||||||
if (Ops.size() == 2) return NewAddRec;
|
if (Ops.size() == 2) return NewAddRec;
|
||||||
Ops[Idx] = NewAddRec;
|
Ops[Idx] = NewAddRec;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
; RUN: opt < %s -analyze -scalar-evolution 2>&1 | FileCheck %s
|
; RUN: opt < %s -analyze -scalar-evolution 2>&1 | FileCheck %s
|
||||||
; XFAIL: *
|
|
||||||
; REQUIRES: asserts
|
; REQUIRES: asserts
|
||||||
|
|
||||||
define void @test(i8 %tmp6) {
|
define void @test(i8 %tmp6) {
|
||||||
|
|
Loading…
Reference in New Issue