aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
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/lib/Analysis/InstructionSimplify.cpp
parent4d36e7704845513a5c9dc5961c6675e7c1f58108 (diff)
downloadllvm-d77a3b61eba36bdd4c9585e5dfa3f779194d21c4.zip
llvm-d77a3b61eba36bdd4c9585e5dfa3f779194d21c4.tar.gz
llvm-d77a3b61eba36bdd4c9585e5dfa3f779194d21c4.tar.bz2
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/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp9
1 files changed, 9 insertions, 0 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;