summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-05-18 17:58:37 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-05-18 17:58:37 +0000
commit0b43b9ee98efbc623f7129c1fd4fb3f5273feb80 (patch)
treee48dee097336d1a545e0da101a5f92ddeebf7e58 /llvm/lib
parent8fa6ebf975dbe11c4ee9df474837a220a1f81a64 (diff)
downloadbcm5719-llvm-0b43b9ee98efbc623f7129c1fd4fb3f5273feb80.tar.gz
bcm5719-llvm-0b43b9ee98efbc623f7129c1fd4fb3f5273feb80.zip
Switch more inst insertion in instcombine to IRBuilder.
llvm-svn: 131544
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 23f87d194b4..670a352e240 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -751,27 +751,20 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
// So at this point we know we have (Y -> OtherAddOp):
// select C, (add X, Y), (sub X, Z)
Value *NegVal; // Compute -Z
- if (Constant *C = dyn_cast<Constant>(SubOp->getOperand(1))) {
- NegVal = ConstantExpr::getNeg(C);
- } else if (SI.getType()->isFloatingPointTy()) {
- NegVal = InsertNewInstBefore(
- BinaryOperator::CreateFNeg(SubOp->getOperand(1),
- "tmp"), SI);
+ if (SI.getType()->isFloatingPointTy()) {
+ NegVal = Builder->CreateFNeg(SubOp->getOperand(1));
} else {
- NegVal = InsertNewInstBefore(
- BinaryOperator::CreateNeg(SubOp->getOperand(1),
- "tmp"), SI);
+ NegVal = Builder->CreateNeg(SubOp->getOperand(1));
}
Value *NewTrueOp = OtherAddOp;
Value *NewFalseOp = NegVal;
if (AddOp != TI)
std::swap(NewTrueOp, NewFalseOp);
- Instruction *NewSel =
- SelectInst::Create(CondVal, NewTrueOp,
- NewFalseOp, SI.getName() + ".p");
+ Value *NewSel =
+ Builder->CreateSelect(CondVal, NewTrueOp,
+ NewFalseOp, SI.getName() + ".p");
- NewSel = InsertNewInstBefore(NewSel, SI);
if (SI.getType()->isFloatingPointTy())
return BinaryOperator::CreateFAdd(SubOp->getOperand(0), NewSel);
else
OpenPOWER on IntegriCloud