[llvm] [AArch64] Only clear kill flags if necessary when merging str (PR #69680)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 01:37:39 PDT 2023


================
@@ -997,8 +997,17 @@ AArch64LoadStoreOpt::mergePairedInsns(MachineBasicBlock::iterator I,
       //   STRWui %w0, ...
       //   USE %w1
       //   STRWui kill %w1  ; need to clear kill flag when moving STRWui upwards
-      RegOp0.setIsKill(false);
-      RegOp1.setIsKill(false);
+      for (auto It = std::next(I);
----------------
nocchijiang wrote:

```suggestion
      // Since w1 is used between the stores, the kill flag on w0 is kept,
      // the one on w1 is dropped after merging:
      //   STPWi kill %w0, %w1, ...
      //   USE %w1
      for (auto It = std::next(I);
```

Do you think adding the sample merging result will be enough?

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


More information about the llvm-commits mailing list