From cc1224e64ef6b3964835205751b0dd8e33e84742 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Mon, 22 Apr 2019 19:30:01 +0000 Subject: [PATCH] [InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from InstCombine 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 | 3 ++- lib/Transforms/InstCombine/InstCombineCalls.cpp | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index c1ae23c6727..f41256b8bb2 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -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. diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 5ae56215944..6f8328405e6 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -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(II.getArgOperand(2)); - if (ConstMask && ConstMask->isNullValue()) - return IC.replaceInstUsesWith(II, II.getArgOperand(3)); - return nullptr; } -- 2.50.1