This transform doesn't require any new instructions, it can safely live
in InstSimplify.
llvm-svn: 275344
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;
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);