LLVM 24.0.0git
AMDGPUPostLegalizerCombiner.cpp
Go to the documentation of this file.
1//=== lib/CodeGen/GlobalISel/AMDGPUPostLegalizerCombiner.cpp --------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This pass does combining of machine instructions at the generic MI level,
10// after the legalizer.
11//
12//===----------------------------------------------------------------------===//
13
14#include "AMDGPU.h"
16#include "AMDGPULegalizerInfo.h"
17#include "GCNSubtarget.h"
26#include "llvm/IR/IntrinsicsAMDGPU.h"
28
29#define GET_GICOMBINER_DEPS
30#include "AMDGPUGenPreLegalizeGICombiner.inc"
31#undef GET_GICOMBINER_DEPS
32
33#define DEBUG_TYPE "amdgpu-postlegalizer-combiner"
34
35using namespace llvm;
36using namespace MIPatternMatch;
37
38namespace {
39#define GET_GICOMBINER_TYPES
40#include "AMDGPUGenPostLegalizeGICombiner.inc"
41#undef GET_GICOMBINER_TYPES
42
43class AMDGPUPostLegalizerCombinerImpl : public Combiner {
44protected:
45 const AMDGPUPostLegalizerCombinerImplRuleConfig &RuleConfig;
46 const GCNSubtarget &STI;
47 const SIInstrInfo &TII;
48 // TODO: Make CombinerHelper methods const.
49 mutable AMDGPUCombinerHelper Helper;
50
51public:
52 AMDGPUPostLegalizerCombinerImpl(
54 GISelCSEInfo *CSEInfo,
55 const AMDGPUPostLegalizerCombinerImplRuleConfig &RuleConfig,
56 const GCNSubtarget &STI, MachineDominatorTree *MDT,
57 const LegalizerInfo *LI);
58
59 static const char *getName() { return "AMDGPUPostLegalizerCombinerImpl"; }
60
61 bool tryCombineAllImpl(MachineInstr &I) const;
62 bool tryCombineAll(MachineInstr &I) const override;
63
64 struct FMinFMaxLegacyInfo {
68 };
69
70 // TODO: Make sure fmin_legacy/fmax_legacy don't canonicalize
71 bool matchFMinFMaxLegacy(MachineInstr &MI, MachineInstr &FCmp,
72 FMinFMaxLegacyInfo &Info) const;
73 void applySelectFCmpToFMinFMaxLegacy(MachineInstr &MI,
74 const FMinFMaxLegacyInfo &Info) const;
75
76 bool matchUCharToFloat(MachineInstr &MI) const;
77 void applyUCharToFloat(MachineInstr &MI) const;
78
79 bool matchFDivSqrtToRsqF16(MachineInstr &MI) const;
80 void applyFDivSqrtToRsqF16(MachineInstr &MI, const Register &X) const;
81
82 // FIXME: Should be able to have 2 separate matchdatas rather than custom
83 // struct boilerplate.
84 struct CvtF32UByteMatchInfo {
85 Register CvtVal;
86 unsigned ShiftOffset;
87 };
88
89 bool matchCvtF32UByteN(MachineInstr &MI,
90 CvtF32UByteMatchInfo &MatchInfo) const;
91 void applyCvtF32UByteN(MachineInstr &MI,
92 const CvtF32UByteMatchInfo &MatchInfo) const;
93
94 bool matchRemoveFcanonicalize(MachineInstr &MI) const;
95
96 // Combine unsigned buffer load and signed extension instructions to generate
97 // signed buffer load instructions.
98 bool matchCombineSignExtendInReg(
99 MachineInstr &MI, std::pair<MachineInstr *, unsigned> &MatchInfo) const;
100 void applyCombineSignExtendInReg(
101 MachineInstr &MI, std::pair<MachineInstr *, unsigned> &MatchInfo) const;
102
103 // Find the s_mul_u64 instructions where the higher bits are either
104 // zero-extended or sign-extended.
105 // Replace the s_mul_u64 instructions with S_MUL_I64_I32_PSEUDO if the higher
106 // 33 bits are sign extended and with S_MUL_U64_U32_PSEUDO if the higher 32
107 // bits are zero extended.
108 bool matchCombine_s_mul_u64(MachineInstr &MI, unsigned &NewOpcode) const;
109
110private:
111#define GET_GICOMBINER_CLASS_MEMBERS
112#define AMDGPUSubtarget GCNSubtarget
113#include "AMDGPUGenPostLegalizeGICombiner.inc"
114#undef GET_GICOMBINER_CLASS_MEMBERS
115#undef AMDGPUSubtarget
116};
117
118#define GET_GICOMBINER_IMPL
119#define AMDGPUSubtarget GCNSubtarget
120#include "AMDGPUGenPostLegalizeGICombiner.inc"
121#undef AMDGPUSubtarget
122#undef GET_GICOMBINER_IMPL
123
124AMDGPUPostLegalizerCombinerImpl::AMDGPUPostLegalizerCombinerImpl(
126 GISelCSEInfo *CSEInfo,
127 const AMDGPUPostLegalizerCombinerImplRuleConfig &RuleConfig,
128 const GCNSubtarget &STI, MachineDominatorTree *MDT, const LegalizerInfo *LI)
129 : Combiner(MF, CInfo, &VT, CSEInfo), RuleConfig(RuleConfig), STI(STI),
130 TII(*STI.getInstrInfo()),
131 Helper(Observer, B, /*IsPreLegalize*/ false, &VT, MDT, LI, STI),
133#include "AMDGPUGenPostLegalizeGICombiner.inc"
135{
136}
137
138bool AMDGPUPostLegalizerCombinerImpl::tryCombineAll(MachineInstr &MI) const {
139 if (tryCombineAllImpl(MI))
140 return true;
141
142 switch (MI.getOpcode()) {
143 case TargetOpcode::G_SHL:
144 case TargetOpcode::G_LSHR:
145 case TargetOpcode::G_ASHR:
146 // On some subtargets, 64-bit shift is a quarter rate instruction. In the
147 // common case, splitting this into a move and a 32-bit shift is faster and
148 // the same code size.
149 return Helper.tryCombineShiftToUnmerge(MI, 32);
150 }
151
152 return false;
153}
154
155bool AMDGPUPostLegalizerCombinerImpl::matchFMinFMaxLegacy(
156 MachineInstr &MI, MachineInstr &FCmp, FMinFMaxLegacyInfo &Info) const {
157 if (!MRI.hasOneNonDBGUse(FCmp.getOperand(0).getReg()))
158 return false;
159
160 Info.Pred =
161 static_cast<CmpInst::Predicate>(FCmp.getOperand(1).getPredicate());
162 Info.LHS = FCmp.getOperand(2).getReg();
163 Info.RHS = FCmp.getOperand(3).getReg();
164 Register True = MI.getOperand(2).getReg();
165 Register False = MI.getOperand(3).getReg();
166
167 // TODO: Handle case where the the selected value is an fneg and the compared
168 // constant is the negation of the selected value.
169 if ((Info.LHS != True || Info.RHS != False) &&
170 (Info.LHS != False || Info.RHS != True))
171 return false;
172
173 // Invert the predicate if necessary so that the apply function can assume
174 // that the select operands are the same as the fcmp operands.
175 // (select (fcmp P, L, R), R, L) -> (select (fcmp !P, L, R), L, R)
176 if (Info.LHS != True)
178
179 // Only match </<=/>=/> not ==/!= etc.
180 return Info.Pred != CmpInst::getSwappedPredicate(Info.Pred);
181}
182
183void AMDGPUPostLegalizerCombinerImpl::applySelectFCmpToFMinFMaxLegacy(
184 MachineInstr &MI, const FMinFMaxLegacyInfo &Info) const {
185 unsigned Opc = (Info.Pred & CmpInst::FCMP_OGT) ? AMDGPU::G_AMDGPU_FMAX_LEGACY
186 : AMDGPU::G_AMDGPU_FMIN_LEGACY;
187 Register X = Info.LHS;
188 Register Y = Info.RHS;
189 if (Info.Pred == CmpInst::getUnorderedPredicate(Info.Pred)) {
190 // We need to permute the operands to get the correct NaN behavior. The
191 // selected operand is the second one based on the failing compare with NaN,
192 // so permute it based on the compare type the hardware uses.
193 std::swap(X, Y);
194 }
195
196 B.buildInstr(Opc, {MI.getOperand(0)}, {X, Y}, MI.getFlags());
197
198 MI.eraseFromParent();
199}
200
201bool AMDGPUPostLegalizerCombinerImpl::matchUCharToFloat(
202 MachineInstr &MI) const {
203 Register DstReg = MI.getOperand(0).getReg();
204
205 // TODO: We could try to match extracting the higher bytes, which would be
206 // easier if i8 vectors weren't promoted to i32 vectors, particularly after
207 // types are legalized. v4i8 -> v4f32 is probably the only case to worry
208 // about in practice.
209 LLT Ty = MRI.getType(DstReg);
210 if (Ty == LLT::scalar(32) || Ty == LLT::scalar(16)) {
211 Register SrcReg = MI.getOperand(1).getReg();
212 unsigned SrcSize = MRI.getType(SrcReg).getSizeInBits();
213 assert(SrcSize == 16 || SrcSize == 32 || SrcSize == 64);
214 const APInt Mask = APInt::getHighBitsSet(SrcSize, SrcSize - 8);
215 return Helper.getValueTracking()->maskedValueIsZero(SrcReg, Mask);
216 }
217
218 return false;
219}
220
221void AMDGPUPostLegalizerCombinerImpl::applyUCharToFloat(
222 MachineInstr &MI) const {
223 const LLT S32 = LLT::scalar(32);
224
225 Register DstReg = MI.getOperand(0).getReg();
226 Register SrcReg = MI.getOperand(1).getReg();
227 LLT Ty = MRI.getType(DstReg);
228 LLT SrcTy = MRI.getType(SrcReg);
229 if (SrcTy != S32)
230 SrcReg = B.buildAnyExtOrTrunc(S32, SrcReg).getReg(0);
231
232 if (Ty == S32) {
233 B.buildInstr(AMDGPU::G_AMDGPU_CVT_F32_UBYTE0, {DstReg}, {SrcReg},
234 MI.getFlags());
235 } else {
236 auto Cvt0 = B.buildInstr(AMDGPU::G_AMDGPU_CVT_F32_UBYTE0, {S32}, {SrcReg},
237 MI.getFlags());
238 B.buildFPTrunc(DstReg, Cvt0, MI.getFlags());
239 }
240
241 MI.eraseFromParent();
242}
243
244bool AMDGPUPostLegalizerCombinerImpl::matchFDivSqrtToRsqF16(
245 MachineInstr &MI) const {
246 Register Sqrt = MI.getOperand(2).getReg();
247 return MRI.hasOneNonDBGUse(Sqrt);
248}
249
250void AMDGPUPostLegalizerCombinerImpl::applyFDivSqrtToRsqF16(
251 MachineInstr &MI, const Register &X) const {
252 Register Dst = MI.getOperand(0).getReg();
253 Register Y = MI.getOperand(1).getReg();
254 LLT DstTy = MRI.getType(Dst);
255 uint32_t Flags = MI.getFlags();
256 Register RSQ = B.buildIntrinsic(Intrinsic::amdgcn_rsq, {DstTy})
257 .addUse(X)
258 .setMIFlags(Flags)
259 .getReg(0);
260 B.buildFMul(Dst, RSQ, Y, Flags);
261 MI.eraseFromParent();
262}
263
264bool AMDGPUPostLegalizerCombinerImpl::matchCvtF32UByteN(
265 MachineInstr &MI, CvtF32UByteMatchInfo &MatchInfo) const {
266 Register SrcReg = MI.getOperand(1).getReg();
267
268 // Look through G_ZEXT.
269 bool IsShr = mi_match(SrcReg, MRI, m_GZExt(m_Reg(SrcReg)));
270
271 Register Src0;
272 int64_t ShiftAmt;
273 IsShr = mi_match(SrcReg, MRI, m_GLShr(m_Reg(Src0), m_ICst(ShiftAmt)));
274 if (IsShr || mi_match(SrcReg, MRI, m_GShl(m_Reg(Src0), m_ICst(ShiftAmt)))) {
275 const unsigned Offset = MI.getOpcode() - AMDGPU::G_AMDGPU_CVT_F32_UBYTE0;
276
277 unsigned ShiftOffset = 8 * Offset;
278 if (IsShr)
279 ShiftOffset += ShiftAmt;
280 else
281 ShiftOffset -= ShiftAmt;
282
283 MatchInfo.CvtVal = Src0;
284 MatchInfo.ShiftOffset = ShiftOffset;
285 return ShiftOffset < 32 && ShiftOffset >= 8 && (ShiftOffset % 8) == 0;
286 }
287
288 // TODO: Simplify demanded bits.
289 return false;
290}
291
292void AMDGPUPostLegalizerCombinerImpl::applyCvtF32UByteN(
293 MachineInstr &MI, const CvtF32UByteMatchInfo &MatchInfo) const {
294 unsigned NewOpc = AMDGPU::G_AMDGPU_CVT_F32_UBYTE0 + MatchInfo.ShiftOffset / 8;
295
296 const LLT S32 = LLT::scalar(32);
297 Register CvtSrc = MatchInfo.CvtVal;
298 LLT SrcTy = MRI.getType(MatchInfo.CvtVal);
299 if (SrcTy != S32) {
300 assert(SrcTy.isScalar() && SrcTy.getSizeInBits() >= 8);
301 CvtSrc = B.buildAnyExt(S32, CvtSrc).getReg(0);
302 }
303
304 assert(MI.getOpcode() != NewOpc);
305 B.buildInstr(NewOpc, {MI.getOperand(0)}, {CvtSrc}, MI.getFlags());
306 MI.eraseFromParent();
307}
308
309bool AMDGPUPostLegalizerCombinerImpl::matchRemoveFcanonicalize(
310 MachineInstr &MI) const {
311 const SITargetLowering *TLI = static_cast<const SITargetLowering *>(
312 MF.getSubtarget().getTargetLowering());
313 return TLI->isCanonicalized(MI.getOperand(1).getReg(), MF);
314}
315
316// The buffer_load_{i8, i16} intrinsics are initially lowered as
317// buffer_load_{u8, u16} instructions. Here, the buffer_load_{u8, u16}
318// instructions are combined with sign extension instrucions in order to
319// generate buffer_load_{i8, i16} instructions.
320
321// Identify buffer_load_{u8, u16}.
322bool AMDGPUPostLegalizerCombinerImpl::matchCombineSignExtendInReg(
323 MachineInstr &MI, std::pair<MachineInstr *, unsigned> &MatchData) const {
324 Register LoadReg = MI.getOperand(1).getReg();
325 if (!MRI.hasOneNonDBGUse(LoadReg))
326 return false;
327
328 // Check if the first operand of the sign extension is a subword buffer load
329 // instruction.
330 MachineInstr *LoadMI = MRI.getVRegDef(LoadReg);
331 int64_t Width = MI.getOperand(2).getImm();
332 switch (LoadMI->getOpcode()) {
333 case AMDGPU::G_AMDGPU_BUFFER_LOAD_UBYTE:
334 MatchData = {LoadMI, AMDGPU::G_AMDGPU_BUFFER_LOAD_SBYTE};
335 return Width == 8;
336 case AMDGPU::G_AMDGPU_BUFFER_LOAD_USHORT:
337 MatchData = {LoadMI, AMDGPU::G_AMDGPU_BUFFER_LOAD_SSHORT};
338 return Width == 16;
339 case AMDGPU::G_AMDGPU_S_BUFFER_LOAD_UBYTE:
340 MatchData = {LoadMI, AMDGPU::G_AMDGPU_S_BUFFER_LOAD_SBYTE};
341 return Width == 8;
342 case AMDGPU::G_AMDGPU_S_BUFFER_LOAD_USHORT:
343 MatchData = {LoadMI, AMDGPU::G_AMDGPU_S_BUFFER_LOAD_SSHORT};
344 return Width == 16;
345 }
346 return false;
347}
348
349// Combine buffer_load_{u8, u16} and the sign extension instruction to generate
350// buffer_load_{i8, i16}.
351void AMDGPUPostLegalizerCombinerImpl::applyCombineSignExtendInReg(
352 MachineInstr &MI, std::pair<MachineInstr *, unsigned> &MatchData) const {
353 auto [LoadMI, NewOpcode] = MatchData;
354 LoadMI->setDesc(TII.get(NewOpcode));
355 // Update the destination register of the load with the destination register
356 // of the sign extension.
357 Register SignExtendInsnDst = MI.getOperand(0).getReg();
358 LoadMI->getOperand(0).setReg(SignExtendInsnDst);
359 // Remove the sign extension.
360 MI.eraseFromParent();
361}
362
363bool AMDGPUPostLegalizerCombinerImpl::matchCombine_s_mul_u64(
364 MachineInstr &MI, unsigned &NewOpcode) const {
365 Register Src0 = MI.getOperand(1).getReg();
366 Register Src1 = MI.getOperand(2).getReg();
367 if (MRI.getType(Src0) != LLT::scalar(64))
368 return false;
369
370 if (VT->getKnownBits(Src1).countMinLeadingZeros() >= 32 &&
371 VT->getKnownBits(Src0).countMinLeadingZeros() >= 32) {
372 NewOpcode = AMDGPU::G_AMDGPU_S_MUL_U64_U32;
373 return true;
374 }
375
376 if (VT->computeNumSignBits(Src1) >= 33 &&
377 VT->computeNumSignBits(Src0) >= 33) {
378 NewOpcode = AMDGPU::G_AMDGPU_S_MUL_I64_I32;
379 return true;
380 }
381 return false;
382}
383
384// Pass boilerplate
385// ================
386
387class AMDGPUPostLegalizerCombiner : public MachineFunctionPass {
388public:
389 static char ID;
390
391 AMDGPUPostLegalizerCombiner(bool IsOptNone = false);
392
393 StringRef getPassName() const override {
394 return "AMDGPUPostLegalizerCombiner";
395 }
396
397 bool runOnMachineFunction(MachineFunction &MF) override;
398
399 void getAnalysisUsage(AnalysisUsage &AU) const override;
400
401private:
402 bool IsOptNone;
403 AMDGPUPostLegalizerCombinerImplRuleConfig RuleConfig;
404};
405} // end anonymous namespace
406
407void AMDGPUPostLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
408 AU.setPreservesCFG();
410 AU.addRequired<GISelValueTrackingAnalysisLegacy>();
411 AU.addPreserved<GISelValueTrackingAnalysisLegacy>();
412 if (!IsOptNone) {
413 AU.addRequired<MachineDominatorTreeWrapperPass>();
414 }
416}
417
418AMDGPUPostLegalizerCombiner::AMDGPUPostLegalizerCombiner(bool IsOptNone)
419 : MachineFunctionPass(ID), IsOptNone(IsOptNone) {
420 if (!RuleConfig.parseCommandLineOption())
421 report_fatal_error("Invalid rule identifier");
422}
423
424bool AMDGPUPostLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) {
425 if (MF.getProperties().hasFailedISel())
426 return false;
427 const Function &F = MF.getFunction();
428 bool EnableOpt =
429 MF.getTarget().getOptLevel() != CodeGenOptLevel::None && !skipFunction(F);
430
432 const AMDGPULegalizerInfo *LI =
433 static_cast<const AMDGPULegalizerInfo *>(ST.getLegalizerInfo());
434
436 &getAnalysis<GISelValueTrackingAnalysisLegacy>().get(MF);
438 IsOptNone ? nullptr
439 : &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
440
441 CombinerInfo CInfo(/*AllowIllegalOps*/ false, /*ShouldLegalizeIllegal*/ true,
442 LI, EnableOpt, F.hasOptSize(), F.hasMinSize());
443 // Disable fixed-point iteration to reduce compile-time
444 CInfo.MaxIterations = 1;
445 CInfo.ObserverLvl = CombinerInfo::ObserverLevel::SinglePass;
446 // Legalizer performs DCE, so a full DCE pass is unnecessary.
447 CInfo.EnableFullDCE = false;
448 AMDGPUPostLegalizerCombinerImpl Impl(MF, CInfo, *VT, /*CSEInfo*/ nullptr,
449 RuleConfig, ST, MDT, LI);
450 return Impl.combineMachineInstrs();
451}
452
453char AMDGPUPostLegalizerCombiner::ID = 0;
454INITIALIZE_PASS_BEGIN(AMDGPUPostLegalizerCombiner, DEBUG_TYPE,
455 "Combine AMDGPU machine instrs after legalization", false,
456 false)
458INITIALIZE_PASS_END(AMDGPUPostLegalizerCombiner, DEBUG_TYPE,
459 "Combine AMDGPU machine instrs after legalization", false,
460 false)
461
463 return new AMDGPUPostLegalizerCombiner(IsOptNone);
464}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define GET_GICOMBINER_CONSTRUCTOR_INITS
This contains common combine transformations that may be used in a combine pass.
constexpr LLT S32
This file declares the targeting of the Machinelegalizer class for AMDGPU.
#define X(NUM, ENUM, NAME)
Definition ELF.h:857
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This contains common combine transformations that may be used in a combine pass,or by the target else...
Option class for Targets to specify which operations are combined how and when.
This contains the base class for all Combiners generated by TableGen.
AMD GCN specific subclass of TargetSubtarget.
Provides analysis for querying information about KnownBits during GISel passes.
#define DEBUG_TYPE
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Contains matchers for matching SSA Machine Instructions.
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition PassSupport.h:42
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition PassSupport.h:39
static StringRef getName(Value *V)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
Target-Independent Code Generator Pass Configuration Options pass.
Value * RHS
Value * LHS
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
Definition APInt.h:293
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition Pass.cpp:278
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
@ FCMP_OGT
0 0 1 0 True if ordered and greater than
Definition InstrTypes.h:744
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Definition InstrTypes.h:890
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
Definition InstrTypes.h:852
Predicate getUnorderedPredicate() const
Definition InstrTypes.h:874
GISelValueTracking * getValueTracking() const
LLVM_ABI bool tryCombineShiftToUnmerge(MachineInstr &MI, unsigned TargetShiftAmount) const
Combiner implementation.
Definition Combiner.h:33
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
The CSE Analysis object.
Definition CSEInfo.h:72
To use KnownBitsInfo analysis in a pass, KnownBitsInfo &Info = getAnalysis<GISelValueTrackingInfoAnal...
bool maskedValueIsZero(Register Val, const APInt &Mask)
constexpr bool isScalar() const
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
constexpr TypeSize getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineFunctionProperties & getProperties() const
Get the function properties.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
LLVM_ABI void setDesc(const MCInstrDesc &TID)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
Register getReg() const
getReg - Returns the register number.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
bool isCanonicalized(SelectionDAG &DAG, SDValue Op, SDNodeFlags UserFlags={}, unsigned MaxDepth=5) const
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
operand_type_match m_Reg()
UnaryOp_match< SrcTy, TargetOpcode::G_ZEXT > m_GZExt(const SrcTy &Src)
ConstantMatch< APInt > m_ICst(APInt &Cst)
bool mi_match(Reg R, const MachineRegisterInfo &MRI, Pattern &&P)
BinaryOp_match< LHS, RHS, TargetOpcode::G_SHL, false > m_GShl(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, TargetOpcode::G_LSHR, false > m_GLShr(const LHS &L, const RHS &R)
Predicate getPredicate(unsigned Condition, unsigned Hint)
Return predicate consisting of specified condition and hint bits.
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
Definition Utils.cpp:1137
FunctionPass * createAMDGPUPostLegalizeCombiner(bool IsOptNone)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:880
@ SinglePass
Enables Observer-based DCE and additional heuristics that retry combining defined and used instructio...