Checks for implicit defs that are unused within a pattern and mark them as dead.
This is done directly at the TableGen level forr efficiency.
The instructions are directly created with the "dead" operand and no further analysis is needed later.
| Paths 
 |  Differential  D157273  
[GlobalISel] Add dead flags to implicit defs in ISel ClosedPublic Authored by Pierre-vh on Aug 7 2023, 4:00 AM. 
Details Summary Checks for implicit defs that are unused within a pattern and mark them as dead. This is done directly at the TableGen level forr efficiency. 
Diff Detail 
 Event TimelineComment Actions A couple of things to note: 
 Comment Actions 
 The only codegen change I spotted was in mul-scalar.ll (X86) Comment Actions 
 It's not really a correctness fix, it's just avoiding regressing > 30 globalisel tests when my fix for that is applied. Most of the cases we're compensating for missing constant folding in GlobalISel 
 Comment Actions 
 Probably can ignore this 
 It doesn't matter, dead flags shouldn't be set on reserved registers but also shouldn't matter Comment Actions 
 I guess if we want to be 100% correct we could check for the presence of RegState::Dead in the flags, and check if we're dealing with a reserved register. 
 arsenm added inline comments. This revision is now accepted and ready to land.Aug 8 2023, 4:17 AM Closed by commit rGc3cfbbc4160c: [GlobalISel] Add dead flags to implicit defs in ISel (authored by Pierre-vh).  ·  Explain WhyAug 9 2023, 5:21 AM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
 
Diff 548132 llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
 llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
 llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-compare.mir
 llvm/test/CodeGen/AArch64/GlobalISel/select-binop.mir
 llvm/test/CodeGen/AArch64/GlobalISel/select-ptr-add.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-add.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-and.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ashr.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-brcond.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-build-vector-trunc.v2s16.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ctpop.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-extract-vector-elt.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert-vector-elt.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-lshr.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-or.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-add3.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-and-or.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-or3.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-smed3.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-umed3.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-pattern-xor3.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-shl.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-smax.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-smin.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-sub.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-umax.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-umin.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-xor.mir
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.make.buffer.rsrc.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.atomic.add.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.atomic.cmpswap.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.atomic.fadd.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.load.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.load.format.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.store.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.store.format.f32.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.atomic.add.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.atomic.cmpswap.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.atomic.fadd.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.load.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.load.format.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.store.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.store.format.f32.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.buffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.tbuffer.load.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.tbuffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.tbuffer.store.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.tbuffer.store.i8.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.ptr.tbuffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.load.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.store.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.store.i8.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.s.buffer.load.ll
 
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.atomic.add.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.atomic.cmpswap.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.atomic.fadd.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.load.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.load.format.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.store.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.store.format.f32.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.atomic.add.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.atomic.cmpswap.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.atomic.fadd.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.load.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.load.format.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.store.format.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.store.format.f32.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.buffer.store.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.tbuffer.load.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.ptr.tbuffer.load.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.tbuffer.load.f16.ll
 llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.tbuffer.load.ll
 llvm/test/CodeGen/Mips/GlobalISel/instruction-select/branch.mir
 llvm/test/CodeGen/Mips/GlobalISel/instruction-select/phi.mir
 llvm/test/CodeGen/X86/GlobalISel/mul-scalar.ll
 llvm/test/CodeGen/X86/GlobalISel/select-add.mir
 llvm/test/CodeGen/X86/GlobalISel/select-and-scalar.mir
 llvm/test/CodeGen/X86/GlobalISel/select-blsi.mir
 llvm/test/CodeGen/X86/GlobalISel/select-blsr.mir
 llvm/test/CodeGen/X86/GlobalISel/select-mul-scalar.mir
 llvm/test/CodeGen/X86/GlobalISel/select-or-scalar.mir
 llvm/test/CodeGen/X86/GlobalISel/select-undef.mir
 llvm/test/CodeGen/X86/GlobalISel/select-xor-scalar.mir
 llvm/utils/TableGen/GlobalISelEmitter.cpp
 llvm/utils/TableGen/GlobalISelMatchTable.h
 llvm/utils/TableGen/GlobalISelMatchTable.cpp
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Can just make the flag value?