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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-regalloc

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/86889.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/MachineCopyPropagation.cpp (+1-1) 


``````````diff
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;

``````````

</details>


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


More information about the llvm-commits mailing list