From d77a3b61eba36bdd4c9585e5dfa3f779194d21c4 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 13 Jul 2016 23:32:53 +0000 Subject: Move a transform from InstCombine to InstSimplify. This transform doesn't require any new instructions, it can safely live in InstSimplify. llvm-svn: 275344 --- llvm/lib/Analysis/InstructionSimplify.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp') 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(*MaskArg)) + if (ConstMask->isNullValue()) + return ArgBegin[3]; + } + // Perform idempotent optimizations if (!IsIdempotent(IID)) return nullptr; -- cgit v1.1