[llvm] [MCP] Use MachineInstr::all_defs instead of MachineInstr::defs in hasOverlappingMultipleDef. (PR #86889)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 16:20:12 PDT 2024


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/86889

defs does not return the defs for inline assembly. We need to use all_defs to find them.

Need to reduce a test case still.

Fixes #86880.

>From 9f59e26d38acb9572e7cd08b1d9ba3e88c56488b Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 27 Mar 2024 16:07:54 -0700
Subject: [PATCH] [MCP] Use MachineInstr::all_defs instead of
 MachineInstr::defs in hasOverlappingMultipleDef.

defs does not return the defs for inline assembly. We need to use
all_defs to find them.

Need to reduce a test case still.

Fixes #86880.
---
 llvm/lib/CodeGen/MachineCopyPropagation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 9a0ab300b21b7a..65c067e4874b17 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -640,7 +640,7 @@ bool MachineCopyPropagation::hasImplicitOverlap(const MachineInstr &MI,
 /// The umull instruction is unpredictable unless RdHi and RdLo are different.
 bool MachineCopyPropagation::hasOverlappingMultipleDef(
     const MachineInstr &MI, const MachineOperand &MODef, Register Def) {
-  for (const MachineOperand &MIDef : MI.defs()) {
+  for (const MachineOperand &MIDef : MI.all_defs()) {
     if ((&MIDef != &MODef) && MIDef.isReg() &&
         TRI->regsOverlap(Def, MIDef.getReg()))
       return true;



More information about the llvm-commits mailing list