[clang] [Clang] Add __datasizeof (PR #67805)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 11:15:56 PDT 2023


================
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK:      define dso_local noundef i32 @_Z4testi(i32 noundef %i) #0 {
+// CHECK-NEXT: entry:
+// CHECK-NEXT:   %i.addr = alloca i32, align 4
+// CHECK-NEXT:   store i32 %i, ptr %i.addr, align 4
+// CHECK-NEXT:   %0 = load i32, ptr %i.addr, align 4
+// CHECK-NEXT:   %inc = add nsw i32 %0, 1
+// CHECK-NEXT:   store i32 %inc, ptr %i.addr, align 4
+// CHECK-NEXT:   %1 = zext i32 %0 to i64
+// CHECK-NEXT:   %2 = mul nuw i64 4, %1
+// CHECK-NEXT:   %3 = load i32, ptr %i.addr, align 4
+// CHECK-NEXT:   ret i32 %3
+// CHECK-NEXT: }
----------------
AaronBallman wrote:

I think you may need to add a more specific triple because of mangling differences between MSVC and Itanium. You should also replace the `%<stuff>` form to use a regex.

Actually, it might be worth generating the test comments via `llvm/utils/update_cc_test_checks.py`

https://github.com/llvm/llvm-project/pull/67805


More information about the cfe-commits mailing list