The function only checks that instruction reads a super-register
containing requested physical register. In case if a sub-register
if being read that is also a use of a super-reg, so added the check.
In particular MI->readsRegister() is broken because of the missing
check. The resulting check is essentially regsOverlap().
Details
Diff Detail
Event Timeline
I have realized the old check was also needed, an instruction reads a register in both cases: if the operand is a subreg of a requested register or if it is a superreg.
With the new patch previous changes to other targets are gone. Therefor gone the ask to review their test changes.
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | Why is TRI optional here? I would expect it to be mandatory if there is a physical register and assert |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | That's a good question why, but it is optional. |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | Here are just some examples of places where the function is called without optional TRI operand and with a physreg: lib/Target/AArch64/AArch64InstrInfo.cpp: 1515│ case AArch64::FCSELDrrr: { lib/Target/AMDGPU/SIInstrInfo.cpp: 4769├> if (MI.findRegisterUseOperandIdx(AMDGPU::SCC) != -1) lib/Target/ARM/ARMLoadStoreOptimizer.cpp: 891├> bool BaseKill = LatestMI->killsRegister(Base); and then: include/llvm/CodeGen/MachineInstr.h: 1134│ bool killsRegister(unsigned Reg, There is huge number of places across all targets. |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | Altogether 2539 tests fail across all targets if TRI check is removed, even if physreg check is in place. |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | Is there any real reason not to pass it in though? I would think it shouldn't be hard to make it mandatory, other than the manual work |
lib/CodeGen/MachineInstr.cpp | ||
---|---|---|
938–939 | I do not think there is such a reason. That is just a lot of places across all backends. |
Why is TRI optional here? I would expect it to be mandatory if there is a physical register and assert