[llvm] [ARM] LHS and RHS should be frozen for LowerCMP (PR #159993)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Sep 21 10:39:23 PDT 2025
    
    
  
https://github.com/AZero13 created https://github.com/llvm/llvm-project/pull/159993
LHS and RHS are used multiple times.
>From 11bf53b043f011883c879b70e8d5fdf7e3e3dded Mon Sep 17 00:00:00 2001
From: AZero13 <gfunni234 at gmail.com>
Date: Sun, 21 Sep 2025 13:38:48 -0400
Subject: [PATCH] [ARM] LHS and RHS should be frozen for LowerCMP
LHS and RHS are used multiple times.
---
 llvm/lib/Target/ARM/ARMISelLowering.cpp | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 9052cbfa89deb..9905a4457f35b 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -10479,6 +10479,9 @@ SDValue ARMTargetLowering::LowerCMP(SDValue Op, SelectionDAG &DAG) const {
 
   // Special case for Thumb1 UCMP only
   if (!IsSigned && Subtarget->isThumb1Only()) {
+    LHS = DAG.getFreeze(LHS);
+    RHS = DAG.getFreeze(RHS);
+
     // For Thumb unsigned comparison, use this sequence:
     // subs r2, r0, r1   ; r2 = LHS - RHS, sets flags
     // sbc r2, r2        ; r2 = r2 - r2 - !carry
    
    
More information about the llvm-commits
mailing list