[SCEV] Add support for `x == constant` to CollectCondition.
Add support for EQ predicates with constant operand. In that case, using the constant instead of an unknown expression should always be beneficial.
This commit is contained in:
parent
179e15d53a
commit
b5a3b901c7
|
@ -12618,6 +12618,10 @@ const SCEV *ScalarEvolution::applyLoopGuards(const SCEV *Expr, const Loop *L) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case CmpInst::ICMP_EQ:
|
||||
if (isa<SCEVConstant>(RHS))
|
||||
RewriteMap[LHSUnknown->getValue()] = RHS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ exit:
|
|||
define void @test_guard_eq_12(i32* nocapture %a, i64 %N) {
|
||||
; CHECK-LABEL: Determining loop execution counts for: @test_guard_eq_12
|
||||
; CHECK-NEXT: Loop %loop: backedge-taken count is %N
|
||||
; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
|
||||
; CHECK-NEXT: Loop %loop: max backedge-taken count is 12
|
||||
; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %N
|
||||
;
|
||||
entry:
|
||||
|
|
Loading…
Reference in New Issue