Skip to content

Commit 21c2ba4

Browse files
committed
[GlobalISel] Remove TargetLowering::isConstantUnsignedBitfieldExtractLegal
Use LegalizerInfo::isLegalOrCustom instead. Differential Revision: https://reviews.llvm.org/D116807
1 parent 9eeb029 commit 21c2ba4

File tree

6 files changed

+2
-27
lines changed

6 files changed

+2
-27
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,12 +1967,6 @@ class TargetLoweringBase {
19671967
/// Should be used only when getIRStackGuard returns nullptr.
19681968
virtual Function *getSSPStackGuardCheck(const Module &M) const;
19691969

1970-
/// \returns true if a constant G_UBFX is legal on the target.
1971-
virtual bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1,
1972-
LLT Ty2) const {
1973-
return false;
1974-
}
1975-
19761970
protected:
19771971
Value *getDefaultSafeStackPointerLocation(IRBuilderBase &IRB,
19781972
bool UseTLS) const;

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,8 +4156,7 @@ bool CombinerHelper::matchBitfieldExtractFromAnd(
41564156
Register Dst = MI.getOperand(0).getReg();
41574157
LLT Ty = MRI.getType(Dst);
41584158
LLT ExtractTy = getTargetLowering().getPreferredShiftAmountTy(Ty);
4159-
if (!getTargetLowering().isConstantUnsignedBitfieldExtractLegal(
4160-
TargetOpcode::G_UBFX, Ty, ExtractTy))
4159+
if (LI && !LI->isLegalOrCustom({TargetOpcode::G_UBFX, {Ty, ExtractTy}}))
41614160
return false;
41624161

41634162
int64_t AndImm, LSBImm;
@@ -4243,8 +4242,7 @@ bool CombinerHelper::matchBitfieldExtractFromShrAnd(
42434242
const Register Dst = MI.getOperand(0).getReg();
42444243
LLT Ty = MRI.getType(Dst);
42454244
LLT ExtractTy = getTargetLowering().getPreferredShiftAmountTy(Ty);
4246-
if (!getTargetLowering().isConstantUnsignedBitfieldExtractLegal(
4247-
TargetOpcode::G_UBFX, Ty, ExtractTy))
4245+
if (LI && !LI->isLegalOrCustom({TargetOpcode::G_UBFX, {Ty, ExtractTy}}))
42484246
return false;
42494247

42504248
// Try to match shr (and x, c1), c2

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26096,11 +26096,6 @@ bool AArch64TargetLowering::isTargetCanonicalConstantNode(SDValue Op) const {
2609626096
TargetLowering::isTargetCanonicalConstantNode(Op);
2609726097
}
2609826098

26099-
bool AArch64TargetLowering::isConstantUnsignedBitfieldExtractLegal(
26100-
unsigned Opc, LLT Ty1, LLT Ty2) const {
26101-
return Ty1 == Ty2 && (Ty1 == LLT::scalar(32) || Ty1 == LLT::scalar(64));
26102-
}
26103-
2610426099
bool AArch64TargetLowering::isComplexDeinterleavingSupported() const {
2610526100
return Subtarget->hasSVE() || Subtarget->hasSVE2() ||
2610626101
Subtarget->hasComplxNum();

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,9 +1243,6 @@ class AArch64TargetLowering : public TargetLowering {
12431243
SDValue getPStateSM(SelectionDAG &DAG, SDValue Chain, SMEAttrs Attrs,
12441244
SDLoc DL, EVT VT) const;
12451245

1246-
bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1,
1247-
LLT Ty2) const override;
1248-
12491246
bool preferScalarizeSplat(SDNode *N) const override;
12501247
};
12511248

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5777,12 +5777,6 @@ AMDGPUTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
57775777
}
57785778
}
57795779

5780-
bool AMDGPUTargetLowering::isConstantUnsignedBitfieldExtractLegal(
5781-
unsigned Opc, LLT Ty1, LLT Ty2) const {
5782-
return (Ty1 == LLT::scalar(32) || Ty1 == LLT::scalar(64)) &&
5783-
Ty2 == LLT::scalar(32);
5784-
}
5785-
57865780
/// Whether it is profitable to sink the operands of an
57875781
/// Instruction I to the basic block of I.
57885782
/// This helps using several modifiers (like abs and neg) more often.

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,6 @@ class AMDGPUTargetLowering : public TargetLowering {
372372

373373
AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override;
374374

375-
bool isConstantUnsignedBitfieldExtractLegal(unsigned Opc, LLT Ty1,
376-
LLT Ty2) const override;
377-
378375
bool shouldSinkOperands(Instruction *I,
379376
SmallVectorImpl<Use *> &Ops) const override;
380377
};

0 commit comments

Comments
 (0)