[llvm] Mark the last use of EFLAGS before the copy's def as a kill if the copy's def operand is itself a kill. (PR #135726)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 18:35:49 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/Target/X86/X86FlagsCopyLowering.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp b/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
index 4e1b81324..6ba84aba1 100644
--- a/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
+++ b/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
@@ -424,19 +424,19 @@ bool X86FlagsCopyLoweringPass::runOnMachineFunction(MachineFunction &MF) {
       if (CopyDefI.getOperand(1).isKill()) {
         MachineBasicBlock *DefMBB = CopyDefI.getParent();
         MachineInstr *LastUse = nullptr;
-        
+
         // Find the last use of EFLAGS before CopyDefI
-        for (auto MI = std::prev(CopyDefI.getIterator()); 
-             MI != DefMBB->begin(); --MI) {
+        for (auto MI = std::prev(CopyDefI.getIterator()); MI != DefMBB->begin();
+             --MI) {
           if (MI->readsRegister(X86::EFLAGS, TRI)) {
             LastUse = &*MI;
             break;
           }
         }
-        
+
         // If we found a last use, mark it as kill
         if (LastUse) {
-          MachineOperand *FlagUse = 
+          MachineOperand *FlagUse =
               LastUse->findRegisterUseOperand(X86::EFLAGS, TRI);
           if (FlagUse)
             FlagUse->setIsKill(true);

``````````

</details>


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


More information about the llvm-commits mailing list