forked from OSchip/llvm-project
[SCEV] Recognize `cond ? i1 0 : i1 y` as `umin_seq ~cond, x`
By definition, `umin_seq` has the exact same poison stopping properties the original `select` had: https://alive2.llvm.org/ce/z/N6XwV-
This commit is contained in:
parent
418604fd90
commit
9766a0cca0
|
@ -6015,6 +6015,13 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHIViaUMinSeq(
|
||||||
/*Sequential=*/true));
|
/*Sequential=*/true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// i1 cond ? i1 0 : i1 y --> umin_seq ~cond, y
|
||||||
|
if (auto *TrueConst = dyn_cast<ConstantInt>(TrueVal)) {
|
||||||
|
if (TrueConst->isZero())
|
||||||
|
return getUMinExpr(getNotSCEV(getSCEV(Cond)), getSCEV(FalseVal),
|
||||||
|
/*Sequential=*/true);
|
||||||
|
}
|
||||||
|
|
||||||
return getUnknown(V);
|
return getUnknown(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ define i1 @select_false_or_x(i1 %c, i1 %x) {
|
||||||
; CHECK-LABEL: 'select_false_or_x'
|
; CHECK-LABEL: 'select_false_or_x'
|
||||||
; CHECK-NEXT: Classifying expressions for: @select_false_or_x
|
; CHECK-NEXT: Classifying expressions for: @select_false_or_x
|
||||||
; CHECK-NEXT: %r = select i1 %c, i1 false, i1 %x
|
; CHECK-NEXT: %r = select i1 %c, i1 false, i1 %x
|
||||||
; CHECK-NEXT: --> %r U: full-set S: full-set
|
; CHECK-NEXT: --> ((true + %c) umin_seq %x) U: full-set S: full-set
|
||||||
; CHECK-NEXT: Determining loop execution counts for: @select_false_or_x
|
; CHECK-NEXT: Determining loop execution counts for: @select_false_or_x
|
||||||
;
|
;
|
||||||
%r = select i1 %c, i1 false, i1 %x
|
%r = select i1 %c, i1 false, i1 %x
|
||||||
|
|
Loading…
Reference in New Issue