[PATCH] D116464: [SPIRV 5/6] Add LegalizerInfo, InstructionSelector and utilities
Aleksandr Bezzubikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 10 11:45:00 PST 2022
zuban32 added inline comments.
================
Comment at: llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp:361-365
+ MachineInstr &AssignTypeInst =
+ *(MRI.use_instr_begin(MI.getOperand(0).getReg()));
+ auto NewReg = createNewIdReg(MI.getOperand(0).getReg(), Opc, MRI, *GR).first;
+ AssignTypeInst.getOperand(1).setReg(NewReg);
+ MI.getOperand(0).setReg(NewReg);
----------------
arsenm wrote:
> zuban32 wrote:
> > arsenm wrote:
> > > You're assuming there's only a single use, and your legalize action should only touch the passed instruction
> > The single-use constraint is enforced by the design of our target, every non-void instruction have the only user - type assignment instruction, which in turn may have multiple users just as the original instruction before.
> This is not a property the target can decide, the incoming IR can have multiple uses. It's simply wrong to rely on it like this
Why not if we have a target-specific LLVM IR pass making that assumption always true?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116464/new/
https://reviews.llvm.org/D116464
More information about the llvm-commits
mailing list