]> granicus.if.org Git - llvm/commitdiff
[InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from...
authorPhilip Reames <listmail@philipreames.com>
Mon, 22 Apr 2019 19:30:01 +0000 (19:30 +0000)
committerPhilip Reames <listmail@philipreames.com>
Mon, 22 Apr 2019 19:30:01 +0000 (19:30 +0000)
In the process, use the existing masked.load combine which is slightly stronger, and handles a mix of zero and undef elements in the mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358913 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InstructionSimplify.cpp
lib/Transforms/InstCombine/InstCombineCalls.cpp

index c1ae23c6727869386143d499846fb265b12c25d1..f41256b8bb27bf84361000bae52266fd80bfa729 100644 (file)
@@ -4876,7 +4876,8 @@ static Value *simplifyIntrinsic(Function *F, IterTy ArgBegin, IterTy ArgEnd,
 
   // Handle intrinsics with 3 or more arguments.
   switch (IID) {
-  case Intrinsic::masked_load: {
+  case Intrinsic::masked_load:
+  case Intrinsic::masked_gather: {
     Value *MaskArg = ArgBegin[2];
     Value *PassthruArg = ArgBegin[3];
     // If the mask is all zeros or undef, the "passthru" argument is the result.
index 5ae562159448c6e3b0ac620df6613c7a6fc06f80..6f8328405e6966e7e6858530889a8c9e1b36452e 100644 (file)
@@ -1220,11 +1220,6 @@ Instruction *InstCombiner::simplifyMaskedStore(IntrinsicInst &II) {
 // * Vector splat address w/known mask -> scalar load
 // * Vector incrementing address -> vector masked load
 static Instruction *simplifyMaskedGather(IntrinsicInst &II, InstCombiner &IC) {
-  // If the mask is all zeros, return the "passthru" argument of the gather.
-  auto *ConstMask = dyn_cast<Constant>(II.getArgOperand(2));
-  if (ConstMask && ConstMask->isNullValue())
-    return IC.replaceInstUsesWith(II, II.getArgOperand(3));
-
   return nullptr;
 }