aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-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 27c10ee..609cd26 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 60a40d4..36c9762 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);