[llvm] [GlobalISel] Support physical register inputs in nested patterns (PR #121239)
Evgenii Kudriashov via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 28 07:41:40 PST 2024
================
@@ -1412,15 +1412,18 @@ Expected<BuildMIAction &> GlobalISelEmitter::createAndImportInstructionRenderer(
action_iterator InsertPt = InsertPtOrError.get();
BuildMIAction &DstMIBuilder = *static_cast<BuildMIAction *>(InsertPt->get());
- for (auto PhysInput : InsnMatcher.getPhysRegInputs()) {
- InsertPt = M.insertAction<BuildMIAction>(
- InsertPt, M.allocateOutputInsnID(),
- &Target.getInstruction(RK.getDef("COPY")));
- BuildMIAction &CopyToPhysRegMIBuilder =
- *static_cast<BuildMIAction *>(InsertPt->get());
- CopyToPhysRegMIBuilder.addRenderer<AddRegisterRenderer>(
- Target, PhysInput.first, true);
- CopyToPhysRegMIBuilder.addRenderer<CopyPhysRegRenderer>(PhysInput.first);
+ for (auto PhysOp : M.physoperands()) {
+ auto &OpInsnMatcher = PhysOp.second->getInstructionMatcher();
+ for (auto PhysInput : OpInsnMatcher.getPhysRegInputs()) {
----------------
e-kud wrote:
@s-barannikov yes, thank you! I'll add this as a test as well.
I assumed that InsnMatcher is a must but we can just take keys from `PhysRegOperands` as only they are needed. And the duplication problem is solved completely as `PhysRegOperands` is a `DenseMap`. Only named phys registers are a problem but it looks like they are not supported yet. The test for them is commented out.
https://github.com/llvm/llvm-project/pull/121239
More information about the llvm-commits
mailing list