[llvm] 75656d8 - [X86] combineStore - remove rangedata when converting 64-bit copies to f64 load/store (#147904)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 01:32:13 PDT 2025


Author: Simon Pilgrim
Date: 2025-07-10T09:32:09+01:00
New Revision: 75656d8c1118ee96f09b88b1c635a5a2d4ca27e6

URL: https://github.com/llvm/llvm-project/commit/75656d8c1118ee96f09b88b1c635a5a2d4ca27e6
DIFF: https://github.com/llvm/llvm-project/commit/75656d8c1118ee96f09b88b1c635a5a2d4ca27e6.diff

LOG: [X86] combineStore - remove rangedata when converting 64-bit copies to f64 load/store (#147904)

We're changing from i64 to f64 - we can't retain any range metadata

Fixes #147781

Added: 
    llvm/test/CodeGen/X86/pr147781.ll

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 347ba1262b66b..1ad1b47a94d28 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -53574,6 +53574,10 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG,
 
     SDLoc LdDL(Ld);
     SDLoc StDL(N);
+
+    // Remove any range metadata as we're converting to f64 load/store.
+    Ld->getMemOperand()->clearRanges();
+
     // Lower to a single movq load/store pair.
     SDValue NewLd = DAG.getLoad(MVT::f64, LdDL, Ld->getChain(),
                                 Ld->getBasePtr(), Ld->getMemOperand());

diff  --git a/llvm/test/CodeGen/X86/pr147781.ll b/llvm/test/CodeGen/X86/pr147781.ll
new file mode 100644
index 0000000000000..9f65fd5984e7b
--- /dev/null
+++ b/llvm/test/CodeGen/X86/pr147781.ll
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=i686-pc-windows-gnu -verify-machineinstrs | FileCheck %s
+
+; Ensure i64 !range data is stripped when converting to f64 load/store.
+define void @test(ptr %p, ptr %p2) #0 {
+; CHECK-LABEL: test:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
+; CHECK-NEXT:    movsd %xmm0, (%eax)
+; CHECK-NEXT:    retl
+  %val = load i64, ptr %p, align 8, !range !0
+  store i64 %val, ptr %p2, align 8
+  ret void
+}
+
+attributes #0 = { "target-cpu"="pentium4" }
+!0 = !{i64 1, i64 0}


        


More information about the llvm-commits mailing list