forked from OSchip/llvm-project
Switch inst insertion in instcombine transform to IRBuilder.
llvm-svn: 131542
This commit is contained in:
parent
1fabbe921b
commit
cde9c1628c
|
@ -604,9 +604,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||||
return BinaryOperator::CreateOr(CondVal, FalseVal);
|
return BinaryOperator::CreateOr(CondVal, FalseVal);
|
||||||
}
|
}
|
||||||
// Change: A = select B, false, C --> A = and !B, C
|
// Change: A = select B, false, C --> A = and !B, C
|
||||||
Value *NotCond =
|
Value *NotCond = Builder->CreateNot(CondVal, "not."+CondVal->getName());
|
||||||
InsertNewInstBefore(BinaryOperator::CreateNot(CondVal,
|
|
||||||
"not."+CondVal->getName()), SI);
|
|
||||||
return BinaryOperator::CreateAnd(NotCond, FalseVal);
|
return BinaryOperator::CreateAnd(NotCond, FalseVal);
|
||||||
} else if (ConstantInt *C = dyn_cast<ConstantInt>(FalseVal)) {
|
} else if (ConstantInt *C = dyn_cast<ConstantInt>(FalseVal)) {
|
||||||
if (C->getZExtValue() == false) {
|
if (C->getZExtValue() == false) {
|
||||||
|
@ -614,9 +612,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||||
return BinaryOperator::CreateAnd(CondVal, TrueVal);
|
return BinaryOperator::CreateAnd(CondVal, TrueVal);
|
||||||
}
|
}
|
||||||
// Change: A = select B, C, true --> A = or !B, C
|
// Change: A = select B, C, true --> A = or !B, C
|
||||||
Value *NotCond =
|
Value *NotCond = Builder->CreateNot(CondVal, "not."+CondVal->getName());
|
||||||
InsertNewInstBefore(BinaryOperator::CreateNot(CondVal,
|
|
||||||
"not."+CondVal->getName()), SI);
|
|
||||||
return BinaryOperator::CreateOr(NotCond, TrueVal);
|
return BinaryOperator::CreateOr(NotCond, TrueVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue