[llvm] [DAG] visitFREEZE - replace multiple frozen/unfrozen uses of an SDValue with just the frozen node (PR #150017)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 08:05:52 PDT 2025
================
@@ -490,18 +490,19 @@ define i32 @freeze_ashr_exact(i32 %a0) nounwind {
define i32 @freeze_ashr_exact_extra_use(i32 %a0, ptr %escape) nounwind {
; X86-LABEL: freeze_ashr_exact_extra_use:
; X86: # %bb.0:
-; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT: sarl $3, %eax
-; X86-NEXT: movl %eax, (%ecx)
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: sarl $3, %ecx
+; X86-NEXT: movl %ecx, (%eax)
+; X86-NEXT: movl %ecx, %eax
; X86-NEXT: sarl $6, %eax
; X86-NEXT: retl
----------------
RKSimon wrote:
DAG still preserves the exact, but instcombine will optimize to:
```ll
define i32 @freeze_ashr_exact_extra_use(i32 %a0, ptr %escape) #0 {
%a0.fr = freeze i32 %a0
%x = ashr i32 %a0.fr, 3
%z = ashr i32 %a0.fr, 9
store i32 %x, ptr %escape, align 4
ret i32 %z
}
```
https://github.com/llvm/llvm-project/pull/150017
More information about the llvm-commits
mailing list