Move a transform from InstCombine to InstSimplify.

This transform doesn't require any new instructions, it can safely live
in InstSimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275344 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2016-07-13 23:32:53 +00:00
parent 95c81ed0a1
commit d2dd1e2fd6
2 changed files with 9 additions and 4 deletions

View File

@ -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;

View File

@ -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);