diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 72 |
2 files changed, 17 insertions, 57 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c97300d..6bf9008 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -26876,6 +26876,8 @@ static SDValue combineTruncationShuffle(ShuffleVectorSDNode *SVN, // TODO: handle more extension/truncation cases as cases arise. if (EltSizeInBits != ExtSrcSizeInBits) return SDValue(); + if (VT.getSizeInBits() != N00.getValueSizeInBits()) + return SDValue(); // We can remove *extend_vector_inreg only if the truncation happens at // the same scale as the extension. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index cb0038c..20a0efd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4837,29 +4837,10 @@ void SelectionDAGBuilder::visitMaskedStore(const CallInst &I, bool IsCompressing) { SDLoc sdl = getCurSDLoc(); - auto getMaskedStoreOps = [&](Value *&Ptr, Value *&Mask, Value *&Src0, - Align &Alignment) { - // llvm.masked.store.*(Src0, Ptr, alignment, Mask) - Src0 = I.getArgOperand(0); - Ptr = I.getArgOperand(1); - Alignment = cast<ConstantInt>(I.getArgOperand(2))->getAlignValue(); - Mask = I.getArgOperand(3); - }; - auto getCompressingStoreOps = [&](Value *&Ptr, Value *&Mask, Value *&Src0, - Align &Alignment) { - // llvm.masked.compressstore.*(Src0, Ptr, Mask) - Src0 = I.getArgOperand(0); - Ptr = I.getArgOperand(1); - Mask = I.getArgOperand(2); - Alignment = I.getParamAlign(1).valueOrOne(); - }; - - Value *PtrOperand, *MaskOperand, *Src0Operand; - Align Alignment; - if (IsCompressing) - getCompressingStoreOps(PtrOperand, MaskOperand, Src0Operand, Alignment); - else - getMaskedStoreOps(PtrOperand, MaskOperand, Src0Operand, Alignment); + Value *Src0Operand = I.getArgOperand(0); + Value *PtrOperand = I.getArgOperand(1); + Value *MaskOperand = I.getArgOperand(2); + Align Alignment = I.getParamAlign(1).valueOrOne(); SDValue Ptr = getValue(PtrOperand); SDValue Src0 = getValue(Src0Operand); @@ -4964,14 +4945,12 @@ static bool getUniformBase(const Value *Ptr, SDValue &Base, SDValue &Index, void SelectionDAGBuilder::visitMaskedScatter(const CallInst &I) { SDLoc sdl = getCurSDLoc(); - // llvm.masked.scatter.*(Src0, Ptrs, alignment, Mask) + // llvm.masked.scatter.*(Src0, Ptrs, Mask) const Value *Ptr = I.getArgOperand(1); SDValue Src0 = getValue(I.getArgOperand(0)); - SDValue Mask = getValue(I.getArgOperand(3)); + SDValue Mask = getValue(I.getArgOperand(2)); EVT VT = Src0.getValueType(); - Align Alignment = cast<ConstantInt>(I.getArgOperand(2)) - ->getMaybeAlignValue() - .value_or(DAG.getEVTAlign(VT.getScalarType())); + Align Alignment = I.getParamAlign(1).valueOrOne(); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); SDValue Base; @@ -5008,29 +4987,10 @@ void SelectionDAGBuilder::visitMaskedScatter(const CallInst &I) { void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I, bool IsExpanding) { SDLoc sdl = getCurSDLoc(); - auto getMaskedLoadOps = [&](Value *&Ptr, Value *&Mask, Value *&Src0, - Align &Alignment) { - // @llvm.masked.load.*(Ptr, alignment, Mask, Src0) - Ptr = I.getArgOperand(0); - Alignment = cast<ConstantInt>(I.getArgOperand(1))->getAlignValue(); - Mask = I.getArgOperand(2); - Src0 = I.getArgOperand(3); - }; - auto getExpandingLoadOps = [&](Value *&Ptr, Value *&Mask, Value *&Src0, - Align &Alignment) { - // @llvm.masked.expandload.*(Ptr, Mask, Src0) - Ptr = I.getArgOperand(0); - Alignment = I.getParamAlign(0).valueOrOne(); - Mask = I.getArgOperand(1); - Src0 = I.getArgOperand(2); - }; - - Value *PtrOperand, *MaskOperand, *Src0Operand; - Align Alignment; - if (IsExpanding) - getExpandingLoadOps(PtrOperand, MaskOperand, Src0Operand, Alignment); - else - getMaskedLoadOps(PtrOperand, MaskOperand, Src0Operand, Alignment); + Value *PtrOperand = I.getArgOperand(0); + Value *MaskOperand = I.getArgOperand(1); + Value *Src0Operand = I.getArgOperand(2); + Align Alignment = I.getParamAlign(0).valueOrOne(); SDValue Ptr = getValue(PtrOperand); SDValue Src0 = getValue(Src0Operand); @@ -5077,16 +5037,14 @@ void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I, bool IsExpanding) { void SelectionDAGBuilder::visitMaskedGather(const CallInst &I) { SDLoc sdl = getCurSDLoc(); - // @llvm.masked.gather.*(Ptrs, alignment, Mask, Src0) + // @llvm.masked.gather.*(Ptrs, Mask, Src0) const Value *Ptr = I.getArgOperand(0); - SDValue Src0 = getValue(I.getArgOperand(3)); - SDValue Mask = getValue(I.getArgOperand(2)); + SDValue Src0 = getValue(I.getArgOperand(2)); + SDValue Mask = getValue(I.getArgOperand(1)); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); EVT VT = TLI.getValueType(DAG.getDataLayout(), I.getType()); - Align Alignment = cast<ConstantInt>(I.getArgOperand(1)) - ->getMaybeAlignValue() - .value_or(DAG.getEVTAlign(VT.getScalarType())); + Align Alignment = I.getParamAlign(0).valueOrOne(); const MDNode *Ranges = getRangeMetadata(I); |