diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index b2a0a8c15cf1..187e000d0272 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -1967,12 +1967,6 @@ class TargetLoweringBase { /// Should be used only when getIRStackGuard returns nullptr. virtual Function *getSSPStackGuardCheck(const Module &M) const; - /// \returns true if a constant G_UBFX is legal on the target. - virtual bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1, - LLT Ty2) const { - return false; - } - protected: Value *getDefaultSafeStackPointerLocation(IRBuilderBase &IRB, bool UseTLS) const; diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index ac75b75bd7ae..9efb70f28fee 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -4156,8 +4156,7 @@ bool CombinerHelper::matchBitfieldExtractFromAnd( Register Dst = MI.getOperand(0).getReg(); LLT Ty = MRI.getType(Dst); LLT ExtractTy = getTargetLowering().getPreferredShiftAmountTy(Ty); - if (!getTargetLowering().isConstantUnsignedBitfieldExtractLegal( - TargetOpcode::G_UBFX, Ty, ExtractTy)) + if (LI && !LI->isLegalOrCustom({TargetOpcode::G_UBFX, {Ty, ExtractTy}})) return false; int64_t AndImm, LSBImm; @@ -4243,8 +4242,7 @@ bool CombinerHelper::matchBitfieldExtractFromShrAnd( const Register Dst = MI.getOperand(0).getReg(); LLT Ty = MRI.getType(Dst); LLT ExtractTy = getTargetLowering().getPreferredShiftAmountTy(Ty); - if (!getTargetLowering().isConstantUnsignedBitfieldExtractLegal( - TargetOpcode::G_UBFX, Ty, ExtractTy)) + if (LI && !LI->isLegalOrCustom({TargetOpcode::G_UBFX, {Ty, ExtractTy}})) return false; // Try to match shr (and x, c1), c2 diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 3de6bd1ec94a..f887cf50662d 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -26096,11 +26096,6 @@ bool AArch64TargetLowering::isTargetCanonicalConstantNode(SDValue Op) const { TargetLowering::isTargetCanonicalConstantNode(Op); } -bool AArch64TargetLowering::isConstantUnsignedBitfieldExtractLegal( - unsigned Opc, LLT Ty1, LLT Ty2) const { - return Ty1 == Ty2 && (Ty1 == LLT::scalar(32) || Ty1 == LLT::scalar(64)); -} - bool AArch64TargetLowering::isComplexDeinterleavingSupported() const { return Subtarget->hasSVE() || Subtarget->hasSVE2() || Subtarget->hasComplxNum(); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h index cb195d648187..9dcfba3a229c 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -1243,9 +1243,6 @@ class AArch64TargetLowering : public TargetLowering { SDValue getPStateSM(SelectionDAG &DAG, SDValue Chain, SMEAttrs Attrs, SDLoc DL, EVT VT) const; - bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1, - LLT Ty2) const override; - bool preferScalarizeSplat(SDNode *N) const override; }; diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 42479b8970c3..607d59db7bcf 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -5777,12 +5777,6 @@ AMDGPUTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const { } } -bool AMDGPUTargetLowering::isConstantUnsignedBitfieldExtractLegal( - unsigned Opc, LLT Ty1, LLT Ty2) const { - return (Ty1 == LLT::scalar(32) || Ty1 == LLT::scalar(64)) && - Ty2 == LLT::scalar(32); -} - /// Whether it is profitable to sink the operands of an /// Instruction I to the basic block of I. /// This helps using several modifiers (like abs and neg) more often. diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h index 199d447a9f70..e971c85ee3f6 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -372,9 +372,6 @@ class AMDGPUTargetLowering : public TargetLowering { AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override; - bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1, - LLT Ty2) const override; - bool shouldSinkOperands(Instruction *I, SmallVectorImpl &Ops) const override; };