summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-04-24 17:57:27 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-04-24 17:57:27 +0000
commit1c9a9f255c5064ba87e2075d11bd007c3b99ae34 (patch)
treedd39d8ca111701f0c75478759d89de7a88a11772 /llvm/lib/Transforms
parentd595d4265baae05696629fb3194065cef573d425 (diff)
downloadbcm5719-llvm-1c9a9f255c5064ba87e2075d11bd007c3b99ae34.tar.gz
bcm5719-llvm-1c9a9f255c5064ba87e2075d11bd007c3b99ae34.zip
[InstCombine] Avoid updating argument demanded elements in separate passes.
As discussed on D17490, we should attempt to update an intrinsic's arguments demanded elements in one pass if we can. llvm-svn: 267355
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 763e5aaf418..3c02d66cff8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1406,17 +1406,20 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
case Intrinsic::x86_sse2_ucomineq_sd: {
// These intrinsics only demand the 0th element of their input vectors. If
// we can simplify the input based on that, do so now.
+ bool MadeChange = false;
Value *Arg0 = II->getArgOperand(0);
Value *Arg1 = II->getArgOperand(1);
unsigned VWidth = Arg0->getType()->getVectorNumElements();
if (Value *V = SimplifyDemandedVectorEltsLow(Arg0, VWidth, 1)) {
II->setArgOperand(0, V);
- return II;
+ MadeChange = true;
}
if (Value *V = SimplifyDemandedVectorEltsLow(Arg1, VWidth, 1)) {
II->setArgOperand(1, V);
- return II;
+ MadeChange = true;
}
+ if (MadeChange)
+ return II;
break;
}
@@ -1531,14 +1534,17 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
// EXTRQ only uses the lowest 64-bits of the first 128-bit vector
// operands and the lowest 16-bits of the second.
+ bool MadeChange = false;
if (Value *V = SimplifyDemandedVectorEltsLow(Op0, VWidth0, 1)) {
II->setArgOperand(0, V);
- return II;
+ MadeChange = true;
}
if (Value *V = SimplifyDemandedVectorEltsLow(Op1, VWidth1, 2)) {
II->setArgOperand(1, V);
- return II;
+ MadeChange = true;
}
+ if (MadeChange)
+ return II;
break;
}
@@ -1626,15 +1632,17 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
// INSERTQI only uses the lowest 64-bits of the first two 128-bit vector
// operands.
+ bool MadeChange = false;
if (Value *V = SimplifyDemandedVectorEltsLow(Op0, VWidth0, 1)) {
II->setArgOperand(0, V);
- return II;
+ MadeChange = true;
}
-
if (Value *V = SimplifyDemandedVectorEltsLow(Op1, VWidth1, 1)) {
II->setArgOperand(1, V);
- return II;
+ MadeChange = true;
}
+ if (MadeChange)
+ return II;
break;
}
OpenPOWER on IntegriCloud