- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[TargetLowering][ARM][PowerPC] LHS and RHS should be frozen for 3-way compares #159993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @llvm/pr-subscribers-backend-risc-v @llvm/pr-subscribers-backend-arm Author: AZero13 (AZero13) ChangesLHS and RHS are used multiple times. Full diff: https://github.com/llvm/llvm-project/pull/159993.diff 1 Files Affected: 
 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
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests
33b991e    to
    a3300f0      
    Compare
  
    LHS and RHS are used multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alive doesn't seem to think this is necessary: https://alive2.llvm.org/ce/z/JLx9Rb
| 
 Wonder if I should remove it from the PowerPC ucmp then if true... I'll look into this tomorrow | 
LHS and RHS are used multiple times.