summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-07-13 23:32:53 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-07-13 23:32:53 +0000
commitd77a3b61eba36bdd4c9585e5dfa3f779194d21c4 (patch)
tree3876cc93187c2a2b8f34b2bbca272fb46f2a1976 /llvm
parent4d36e7704845513a5c9dc5961c6675e7c1f58108 (diff)
downloadbcm5719-llvm-d77a3b61eba36bdd4c9585e5dfa3f779194d21c4.tar.gz
bcm5719-llvm-d77a3b61eba36bdd4c9585e5dfa3f779194d21c4.zip
Move a transform from InstCombine to InstSimplify.
This transform doesn't require any new instructions, it can safely live in InstSimplify. llvm-svn: 275344
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp9
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp4
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 27c10ee7cf8..609cd26bcd0 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3991,6 +3991,15 @@ static Value *SimplifyIntrinsic(Function *F, IterTy ArgBegin, IterTy ArgEnd,
Q.DL);
}
+ // Simplify calls to llvm.masked.load.*
+ if (IID == Intrinsic::masked_load) {
+ IterTy MaskArg = ArgBegin + 2;
+ // If the mask is all zeros, the "passthru" argument is the result.
+ if (auto *ConstMask = dyn_cast<Constant>(*MaskArg))
+ if (ConstMask->isNullValue())
+ return ArgBegin[3];
+ }
+
// Perform idempotent optimizations
if (!IsIdempotent(IID))
return nullptr;
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 60a40d489fb..36c9762eff4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1044,10 +1044,6 @@ static Value *simplifyMaskedLoad(const IntrinsicInst &II,
if (!ConstMask)
return nullptr;
- // If the mask is all zeros, the "passthru" argument is the result.
- if (ConstMask->isNullValue())
- return II.getArgOperand(3);
-
// If the mask is all ones, this is a plain vector load of the 1st argument.
if (ConstMask->isAllOnesValue()) {
Value *LoadPtr = II.getArgOperand(0);
OpenPOWER on IntegriCloud