[llvm] Address Codegen bug related to marking subregister MachineOperand defines as undef (PR #134929)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 20:09:53 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/CodeGen/LiveIntervals.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index eab1f1e03..f2627aede 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -1579,13 +1579,13 @@ void LiveIntervals::handleMove(MachineInstr &MI, bool UpdateFlags) {
       SlotIndex Index = Indexes->getInstructionIndex(MI);
       LiveInterval &LI = getInterval(MO.getReg());
       LiveRange::iterator IndexSeg = LI.find(Index);
-      if (std::next(IndexSeg) == LI.end()) continue;
+      if (std::next(IndexSeg) == LI.end())
+        continue;
       if (MachineInstr *NextMI =
-          getInstructionFromIndex(std::next(IndexSeg)->valno->def)) {
+              getInstructionFromIndex(std::next(IndexSeg)->valno->def)) {
         for (MachineOperand &NextMO : NextMI->operands()) {
-          if (NextMO.isReg() && NextMO.isDef() &&
-              NextMO.getSubReg() != 0 && NextMO.isUndef() &&
-              NextMO.getReg() == MO.getReg()) {
+          if (NextMO.isReg() && NextMO.isDef() && NextMO.getSubReg() != 0 &&
+              NextMO.isUndef() && NextMO.getReg() == MO.getReg()) {
             MO.setIsUndef(true);
             NextMO.setIsUndef(false);
           }

``````````

</details>


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


More information about the llvm-commits mailing list