Author: Erich Keane
Date: 2026-08-28T15:22:05Z
New Revision: eac739f40147c5d7d009e2c0521975d2556fe3a9

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

LOG: [CIR] Fix ptrdiff tests (ptrtoint/ptrtoaddr) (#219491)

This seemingly got reverted in classic codegen?

  I leave a version of the TODO in place since I suspect we'll see it
  agian.

Added: 
    

Modified: 
    clang/test/CIR/CodeGen/ptrdiff.c
    clang/test/CIR/CodeGen/ptrdiff.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CIR/CodeGen/ptr
diff .c b/clang/test/CIR/CodeGen/ptr
diff .c
index cf28cedf0f7ec..26ce6f718e96f 100644
--- a/clang/test/CIR/CodeGen/ptr
diff .c
+++ b/clang/test/CIR/CodeGen/ptr
diff .c
@@ -17,10 +17,13 @@ int addrcmp(const void* a, const void* b) {
   // LLVM-NOT: sdiv
   // LLVM: trunc i64 %[[SUB]] to i32
 
-  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr)
+  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr).
+  // Classic-codegen seems to have temporarily reverted that
+  // 
diff erence, but we should leave the TODO to make sure we
+  // don't lose it next time it comes back.
   // OGCG-LABEL: define dso_local i32 @addrcmp(
-  // OGCG: %[[PTR_A:.*]] = ptrtoaddr ptr {{.*}} to i64
-  // OGCG: %[[PTR_B:.*]] = ptrtoaddr ptr {{.*}} to i64
+  // OGCG: %[[PTR_A:.*]] = ptrtoint ptr {{.*}} to i64
+  // OGCG: %[[PTR_B:.*]] = ptrtoint ptr {{.*}} to i64
   // OGCG: %[[SUB:.*]] = sub i64 %[[PTR_A]], %[[PTR_B]]
   // OGCG-NOT: sdiv
   // OGCG: trunc i64 %[[SUB]] to i32
@@ -42,10 +45,13 @@ unsigned long long test_ptr_
diff (int *a, int* b) {
   // LLVM: %[[RETLOAD:.*]] = load i64, ptr %[[RETADDR]], align
   // LLVM: ret i64 %[[RETLOAD]]
 
-  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr)
+  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr).
+  // Classic-codegen seems to have temporarily reverted that
+  // 
diff erence, but we should leave the TODO to make sure we
+  // don't lose it next time it comes back.
   // OGCG-LABEL: define dso_local i64 @test_ptr_
diff (
-  // OGCG: %[[IA:.*]] = ptrtoaddr ptr %{{.*}} to i64
-  // OGCG: %[[IB:.*]] = ptrtoaddr ptr %{{.*}} to i64
+  // OGCG: %[[IA:.*]] = ptrtoint ptr %{{.*}} to i64
+  // OGCG: %[[IB:.*]] = ptrtoint ptr %{{.*}} to i64
   // OGCG: %[[SUB:.*]] = sub i64 %[[IA]], %[[IB]]
   // OGCG: %[[Q:.*]] = sdiv exact i64 %[[SUB]], 4
   // OGCG: ret i64 %[[Q]]

diff  --git a/clang/test/CIR/CodeGen/ptr
diff .cpp b/clang/test/CIR/CodeGen/ptr
diff .cpp
index 0d40c563c6403..a88c9fc335a4a 100644
--- a/clang/test/CIR/CodeGen/ptr
diff .cpp
+++ b/clang/test/CIR/CodeGen/ptr
diff .cpp
@@ -22,10 +22,13 @@ size_type size(unsigned long *_start, unsigned long 
*_finish) {
   // LLVM: %[[RET:.*]] = load i64, ptr %[[RETADDR]], align
   // LLVM: ret i64 %[[RET]]
 
-  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr)
+  // TODO: Fix inconsistency with LLVM (ptrtoint vs ptrtoaddr).
+  // Classic-codegen seems to have temporarily reverted that
+  // 
diff erence, but we should leave the TODO to make sure we
+  // don't lose it next time it comes back.
   // OGCG-LABEL: define dso_local {{.*}}i64 @_Z4sizePmS_(
-  // OGCG: %[[IA:.*]] = ptrtoaddr ptr %{{.*}} to i64
-  // OGCG: %[[IB:.*]] = ptrtoaddr ptr %{{.*}} to i64
+  // OGCG: %[[IA:.*]] = ptrtoint ptr %{{.*}} to i64
+  // OGCG: %[[IB:.*]] = ptrtoint ptr %{{.*}} to i64
   // OGCG: %[[SUB:.*]] = sub i64 %[[IA]], %[[IB]]
   // OGCG: %[[Q:.*]] = sdiv exact i64 %[[SUB]], 8
   // OGCG: ret i64 %[[Q]]


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to