forked from OSchip/llvm-project
[NFC][SCEV] `createNodeForSelectOrPHIViaUMinSeq()`: refactor `i1 cond ? i1 x : i1 C` pattern
https://alive2.llvm.org/ce/z/2Q7Du_
This commit is contained in:
parent
9766a0cca0
commit
576a45f20d
|
@ -5994,10 +5994,12 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHIViaUMinSeq(
|
|||
!FalseVal->getType()->isIntegerTy(1))
|
||||
return getUnknown(V);
|
||||
|
||||
// i1 cond ? i1 x : i1 0 --> umin_seq cond, x
|
||||
if (auto *FalseConst = dyn_cast<ConstantInt>(FalseVal)) {
|
||||
if (FalseConst->isZero())
|
||||
return getUMinExpr(getSCEV(Cond), getSCEV(TrueVal), /*Sequential=*/true);
|
||||
// i1 cond ? i1 x : i1 C --> C + (umin_seq cond, x + C)
|
||||
if (isa<ConstantInt>(FalseVal)) {
|
||||
const SCEV *C = getSCEV(FalseVal);
|
||||
return getAddExpr(C, getUMinExpr(getSCEV(Cond),
|
||||
getAddExpr(C, getSCEV(TrueVal)),
|
||||
/*Sequential=*/true));
|
||||
}
|
||||
|
||||
// i1 cond ? i1 1 : i1 y --> ~umin_seq ~cond, ~y
|
||||
|
@ -6008,13 +6010,6 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHIViaUMinSeq(
|
|||
/*Sequential=*/true));
|
||||
}
|
||||
|
||||
// i1 cond ? i1 x : i1 1 --> ~umin_seq cond, ~x
|
||||
if (auto *FalseConst = dyn_cast<ConstantInt>(FalseVal)) {
|
||||
if (FalseConst->isOne())
|
||||
return getNotSCEV(getUMinExpr(getSCEV(Cond), getNotSCEV(getSCEV(TrueVal)),
|
||||
/*Sequential=*/true));
|
||||
}
|
||||
|
||||
// i1 cond ? i1 0 : i1 y --> umin_seq ~cond, y
|
||||
if (auto *TrueConst = dyn_cast<ConstantInt>(TrueVal)) {
|
||||
if (TrueConst->isZero())
|
||||
|
|
Loading…
Reference in New Issue