[llvm] [ARM] isShifterOpProfitable should return true if we are optimizing for size (PR #158683)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 09:51:58 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: AZero13 (AZero13)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
index 9ad46df159c20..a201d81507e9d 100644
--- a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -542,7 +542,7 @@ bool ARMDAGToDAGISel::isShifterOpProfitable(const SDValue &Shift,
                                             unsigned ShAmt) {
   if (!Subtarget->isLikeA9() && !Subtarget->isSwift())
     return true;
-  if (Shift.hasOneUse())
+  if (Shift.hasOneUse() || CurDAG->shouldOptForSize())
     return true;
   // R << 2 is free.
   return ShOpcVal == ARM_AM::lsl &&

``````````

</details>


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


More information about the llvm-commits mailing list