[clang] [clang][cir] Fix tests post #210729 (PR #216963)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 02:21:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/216963.diff
2 Files Affected:
- (modified) clang/test/CIR/CodeGen/ptrdiff.c (+7-5)
- (modified) clang/test/CIR/CodeGen/ptrdiff.cpp (+4-3)
``````````diff
diff --git a/clang/test/CIR/CodeGen/ptrdiff.c b/clang/test/CIR/CodeGen/ptrdiff.c
index e6a754ebc8d4b..cf28cedf0f7ec 100644
--- a/clang/test/CIR/CodeGen/ptrdiff.c
+++ b/clang/test/CIR/CodeGen/ptrdiff.c
@@ -17,9 +17,10 @@ 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)
// OGCG-LABEL: define dso_local i32 @addrcmp(
- // OGCG: %[[PTR_A:.*]] = ptrtoint ptr {{.*}} to i64
- // OGCG: %[[PTR_B:.*]] = ptrtoint ptr {{.*}} to i64
+ // OGCG: %[[PTR_A:.*]] = ptrtoaddr ptr {{.*}} to i64
+ // OGCG: %[[PTR_B:.*]] = ptrtoaddr ptr {{.*}} to i64
// OGCG: %[[SUB:.*]] = sub i64 %[[PTR_A]], %[[PTR_B]]
// OGCG-NOT: sdiv
// OGCG: trunc i64 %[[SUB]] to i32
@@ -41,11 +42,12 @@ 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)
// OGCG-LABEL: define dso_local i64 @test_ptr_diff(
- // OGCG: %[[IA:.*]] = ptrtoint ptr %{{.*}} to i64
- // OGCG: %[[IB:.*]] = ptrtoint ptr %{{.*}} to i64
+ // OGCG: %[[IA:.*]] = ptrtoaddr ptr %{{.*}} to i64
+ // OGCG: %[[IB:.*]] = ptrtoaddr ptr %{{.*}} to i64
// OGCG: %[[SUB:.*]] = sub i64 %[[IA]], %[[IB]]
// OGCG: %[[Q:.*]] = sdiv exact i64 %[[SUB]], 4
// OGCG: ret i64 %[[Q]]
return a - b;
-}
\ No newline at end of file
+}
diff --git a/clang/test/CIR/CodeGen/ptrdiff.cpp b/clang/test/CIR/CodeGen/ptrdiff.cpp
index 5805349b74879..0d40c563c6403 100644
--- a/clang/test/CIR/CodeGen/ptrdiff.cpp
+++ b/clang/test/CIR/CodeGen/ptrdiff.cpp
@@ -22,12 +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)
// OGCG-LABEL: define dso_local {{.*}}i64 @_Z4sizePmS_(
- // OGCG: %[[IA:.*]] = ptrtoint ptr %{{.*}} to i64
- // OGCG: %[[IB:.*]] = ptrtoint ptr %{{.*}} to i64
+ // OGCG: %[[IA:.*]] = ptrtoaddr ptr %{{.*}} to i64
+ // OGCG: %[[IB:.*]] = ptrtoaddr ptr %{{.*}} to i64
// OGCG: %[[SUB:.*]] = sub i64 %[[IA]], %[[IB]]
// OGCG: %[[Q:.*]] = sdiv exact i64 %[[SUB]], 8
// OGCG: ret i64 %[[Q]]
return static_cast<size_type>(_finish - _start);
-}
\ No newline at end of file
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/216963
More information about the cfe-commits
mailing list