[clang] 0bd281e - CodeGen: hand two tests to the care of update_cc_test_checks
Augie Fackler via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 12 14:40:00 PDT 2023
Author: Augie Fackler
Date: 2023-06-12T17:39:44-04:00
New Revision: 0bd281eceff58f1e92eed6b53a33152be9810b42
URL: https://github.com/llvm/llvm-project/commit/0bd281eceff58f1e92eed6b53a33152be9810b42
DIFF: https://github.com/llvm/llvm-project/commit/0bd281eceff58f1e92eed6b53a33152be9810b42.diff
LOG: CodeGen: hand two tests to the care of update_cc_test_checks
These two tests were pretty challenging to manage by hand, and in
rebasing the next change in my stack I finally ran out of patience and
decided to just embrace automation. This change _only_ changes the tests
so that it's obvious what's new in the next change.
Differential Revision: https://reviews.llvm.org/D152400
Added:
Modified:
clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp b/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
index a70f3bb090f34..bf5a150b58909 100644
--- a/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
+++ b/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
@@ -1,50 +1,95 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 -fsanitize=alignment -fno-sanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
-// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
-// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-trap=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
+// RUN: %clang_cc1 -fsanitize=alignment -fno-sanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-NORECOVER
+// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-RECOVER
+// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-trap=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-TRAP
-// CHECK-SANITIZE-ANYRECOVER: @[[CHAR:.*]] = {{.*}} c"'char **'\00" }
-// CHECK-SANITIZE-ANYRECOVER: @[[LINE_100_ALIGNMENT_ASSUMPTION:.*]] = {{.*}}, i32 100, i32 10 }, {{.*}} @[[CHAR]] }
char **__attribute__((alloc_align(2)))
+// CHECK-LABEL: define dso_local noundef ptr @_Z11passthroughPPcm
+// CHECK-SAME: (ptr noundef [[X:%.*]], i64 noundef [[ALIGNMENT:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i64, align 8
+// CHECK-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-NEXT: store i64 [[ALIGNMENT]], ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-NEXT: ret ptr [[TMP0]]
+//
passthrough(char **x, unsigned long alignment) {
- // CHECK: define{{.*}} ptr @[[PASSTHROUGH:.*]](ptr noundef %[[X:.*]], i64 noundef %[[ALIGNMENT:.*]])
- // CHECK-NEXT: entry:
- // CHECK-NEXT: %[[X_ADDR:.*]] = alloca ptr, align 8
- // CHECK-NEXT: %[[ALIGNMENT_ADDR:.*]] = alloca i64, align 8
- // CHECK-NEXT: store ptr %[[X]], ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: store i64 %[[ALIGNMENT]], ptr %[[ALIGNMENT_ADDR]], align 8
- // CHECK-NEXT: %[[X_RELOADED:.*]] = load ptr, ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: ret ptr %[[X_RELOADED]]
- // CHECK-NEXT: }
return x;
}
+// CHECK-SANITIZE-NORECOVER-LABEL: define dso_local noundef ptr @_Z6callerPPcm
+// CHECK-SANITIZE-NORECOVER-SAME: (ptr noundef [[X:%.*]], i64 noundef [[ALIGNMENT:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-NORECOVER-NEXT: entry:
+// CHECK-SANITIZE-NORECOVER-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i64, align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: store i64 [[ALIGNMENT]], ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP1:%.*]] = load i64, ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef [[TMP1]])
+// CHECK-SANITIZE-NORECOVER-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], 1
+// CHECK-SANITIZE-NORECOVER-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], [[TMP2]]
+// CHECK-SANITIZE-NORECOVER-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP3:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-NORECOVER-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[HANDLER_ALIGNMENT_ASSUMPTION:%.*]], !prof [[PROF3:![0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-NORECOVER: handler.alignment_assumption:
+// CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_alignment_assumption_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP3]], i64 [[TMP1]], i64 0) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-NORECOVER-NEXT: unreachable, !nosanitize !2
+// CHECK-SANITIZE-NORECOVER: cont:
+// CHECK-SANITIZE-NORECOVER-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 [[TMP1]]) ]
+// CHECK-SANITIZE-NORECOVER-NEXT: ret ptr [[CALL]]
+//
+// CHECK-SANITIZE-RECOVER-LABEL: define dso_local noundef ptr @_Z6callerPPcm
+// CHECK-SANITIZE-RECOVER-SAME: (ptr noundef [[X:%.*]], i64 noundef [[ALIGNMENT:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-RECOVER-NEXT: entry:
+// CHECK-SANITIZE-RECOVER-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i64, align 8
+// CHECK-SANITIZE-RECOVER-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: store i64 [[ALIGNMENT]], ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP1:%.*]] = load i64, ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef [[TMP1]])
+// CHECK-SANITIZE-RECOVER-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], 1
+// CHECK-SANITIZE-RECOVER-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], [[TMP2]]
+// CHECK-SANITIZE-RECOVER-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP3:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-RECOVER-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[HANDLER_ALIGNMENT_ASSUMPTION:%.*]], !prof [[PROF3:![0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER: handler.alignment_assumption:
+// CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_alignment_assumption(ptr @[[GLOB1:[0-9]+]], i64 [[TMP3]], i64 [[TMP1]], i64 0) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER-NEXT: br label [[CONT]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER: cont:
+// CHECK-SANITIZE-RECOVER-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 [[TMP1]]) ]
+// CHECK-SANITIZE-RECOVER-NEXT: ret ptr [[CALL]]
+//
+// CHECK-SANITIZE-TRAP-LABEL: define dso_local noundef ptr @_Z6callerPPcm
+// CHECK-SANITIZE-TRAP-SAME: (ptr noundef [[X:%.*]], i64 noundef [[ALIGNMENT:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-TRAP-NEXT: entry:
+// CHECK-SANITIZE-TRAP-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i64, align 8
+// CHECK-SANITIZE-TRAP-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: store i64 [[ALIGNMENT]], ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP1:%.*]] = load i64, ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef [[TMP1]])
+// CHECK-SANITIZE-TRAP-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], 1
+// CHECK-SANITIZE-TRAP-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], [[TMP2]]
+// CHECK-SANITIZE-TRAP-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP3:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-TRAP-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[TRAP:%.*]], !nosanitize !2
+// CHECK-SANITIZE-TRAP: trap:
+// CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 23) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-TRAP-NEXT: unreachable, !nosanitize !2
+// CHECK-SANITIZE-TRAP: cont:
+// CHECK-SANITIZE-TRAP-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 [[TMP1]]) ]
+// CHECK-SANITIZE-TRAP-NEXT: ret ptr [[CALL]]
+//
char **caller(char **x, unsigned long alignment) {
- // CHECK: define{{.*}} ptr @{{.*}}(ptr noundef %[[X:.*]], i64 noundef %[[ALIGNMENT:.*]])
- // CHECK-NEXT: entry:
- // CHECK-NEXT: %[[X_ADDR:.*]] = alloca ptr, align 8
- // CHECK-NEXT: %[[ALIGNMENT_ADDR:.*]] = alloca i64, align 8
- // CHECK-NEXT: store ptr %[[X]], ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: store i64 %[[ALIGNMENT]], ptr %[[ALIGNMENT_ADDR]], align 8
- // CHECK-NEXT: %[[X_RELOADED:.*]] = load ptr, ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: %[[ALIGNMENT_RELOADED:.*]] = load i64, ptr %[[ALIGNMENT_ADDR]], align 8
- // CHECK-NEXT: %[[X_RETURNED:.*]] = call noundef ptr @[[PASSTHROUGH]](ptr noundef %[[X_RELOADED]], i64 noundef %[[ALIGNMENT_RELOADED]])
- // CHECK-SANITIZE-NEXT: %[[PTRINT:.*]] = ptrtoint ptr %[[X_RETURNED]] to i64
- // CHECK-SANITIZE-NEXT: %[[MASK:.*]] = sub i64 %[[ALIGNMENT_RELOADED]], 1
- // CHECK-SANITIZE-NEXT: %[[MASKEDPTR:.*]] = and i64 %[[PTRINT]], %[[MASK]]
- // CHECK-SANITIZE-NEXT: %[[MASKCOND:.*]] = icmp eq i64 %[[MASKEDPTR]], 0
- // CHECK-SANITIZE-NEXT: %[[PTRINT_DUP:.*]] = ptrtoint ptr %[[X_RETURNED]] to i64, !nosanitize
- // CHECK-SANITIZE-NEXT: br i1 %[[MASKCOND]], label %[[CONT:.*]], label %[[HANDLER_ALIGNMENT_ASSUMPTION:[^,]+]],{{.*}} !nosanitize
- // CHECK-SANITIZE: [[HANDLER_ALIGNMENT_ASSUMPTION]]:
- // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_alignment_assumption_abort(ptr @[[LINE_100_ALIGNMENT_ASSUMPTION]], i64 %[[PTRINT_DUP]], i64 %[[ALIGNMENT_RELOADED]], i64 0){{.*}}, !nosanitize
- // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_alignment_assumption(ptr @[[LINE_100_ALIGNMENT_ASSUMPTION]], i64 %[[PTRINT_DUP]], i64 %[[ALIGNMENT_RELOADED]], i64 0){{.*}}, !nosanitize
- // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 23){{.*}}, !nosanitize
- // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
- // CHECK-SANITIZE: [[CONT]]:
- // CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr %[[X_RETURNED]], i64 %1) ]
- // CHECK-NEXT: ret ptr %[[X_RETURNED]]
- // CHECK-NEXT: }
#line 100
return passthrough(x, alignment);
}
diff --git a/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp b/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp
index 6c6540e9311c1..60a94c1067f51 100644
--- a/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp
+++ b/clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp
@@ -1,47 +1,92 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
-// RUN: %clang_cc1 -fsanitize=alignment -fno-sanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
-// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
-// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-trap=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
+// RUN: %clang_cc1 -fsanitize=alignment -fno-sanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-NORECOVER
+// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-recover=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-RECOVER
+// RUN: %clang_cc1 -fsanitize=alignment -fsanitize-trap=alignment -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_alignment_assumption" --check-prefixes=CHECK,CHECK-SANITIZE-TRAP
-// CHECK-SANITIZE-ANYRECOVER: @[[CHAR:.*]] = {{.*}} c"'char **'\00" }
-// CHECK-SANITIZE-ANYRECOVER: @[[LINE_100_ALIGNMENT_ASSUMPTION:.*]] = {{.*}}, i32 100, i32 10 }, {{.*}} @[[CHAR]] }
char **__attribute__((alloc_align(2)))
+// CHECK-LABEL: define dso_local noundef ptr @_Z11passthroughPPcm
+// CHECK-SAME: (ptr noundef [[X:%.*]], i64 noundef [[ALIGNMENT:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i64, align 8
+// CHECK-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-NEXT: store i64 [[ALIGNMENT]], ptr [[ALIGNMENT_ADDR]], align 8
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-NEXT: ret ptr [[TMP0]]
+//
passthrough(char **x, unsigned long alignment) {
- // CHECK: define{{.*}} ptr @[[PASSTHROUGH:.*]](ptr noundef %[[X:.*]], i64 noundef %[[ALIGNMENT:.*]])
- // CHECK-NEXT: entry:
- // CHECK-NEXT: %[[X_ADDR:.*]] = alloca ptr, align 8
- // CHECK-NEXT: %[[ALIGNMENT_ADDR:.*]] = alloca i64, align 8
- // CHECK-NEXT: store ptr %[[X]], ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: store i64 %[[ALIGNMENT]], ptr %[[ALIGNMENT_ADDR]], align 8
- // CHECK-NEXT: %[[X_RELOADED:.*]] = load ptr, ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: ret ptr %[[X_RELOADED]]
- // CHECK-NEXT: }
return x;
}
+// CHECK-NOSANITIZE-LABEL: define dso_local noundef ptr @_Z6callerPPc
+// CHECK-NOSANITIZE-SAME: (ptr noundef [[X:%.*]]) #[[ATTR0]] {
+// CHECK-NOSANITIZE-NEXT: entry:
+// CHECK-NOSANITIZE-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NOSANITIZE-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-NOSANITIZE-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-NOSANITIZE-NEXT: [[CALL:%.*]] = call noundef align 128 ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef 128)
+// CHECK-NOSANITIZE-NEXT: ret ptr [[CALL]]
+//
+// CHECK-SANITIZE-NORECOVER-LABEL: define dso_local noundef ptr @_Z6callerPPc
+// CHECK-SANITIZE-NORECOVER-SAME: (ptr noundef [[X:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-NORECOVER-NEXT: entry:
+// CHECK-SANITIZE-NORECOVER-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-NORECOVER-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef 128)
+// CHECK-SANITIZE-NORECOVER-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-NORECOVER-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 127
+// CHECK-SANITIZE-NORECOVER-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-NORECOVER-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-NORECOVER-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[HANDLER_ALIGNMENT_ASSUMPTION:%.*]], !prof [[PROF3:![0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-NORECOVER: handler.alignment_assumption:
+// CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_alignment_assumption_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP1]], i64 128, i64 0) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-NORECOVER-NEXT: unreachable, !nosanitize !2
+// CHECK-SANITIZE-NORECOVER: cont:
+// CHECK-SANITIZE-NORECOVER-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 128) ]
+// CHECK-SANITIZE-NORECOVER-NEXT: ret ptr [[CALL]]
+//
+// CHECK-SANITIZE-RECOVER-LABEL: define dso_local noundef ptr @_Z6callerPPc
+// CHECK-SANITIZE-RECOVER-SAME: (ptr noundef [[X:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-RECOVER-NEXT: entry:
+// CHECK-SANITIZE-RECOVER-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-RECOVER-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-RECOVER-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef 128)
+// CHECK-SANITIZE-RECOVER-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-RECOVER-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 127
+// CHECK-SANITIZE-RECOVER-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-RECOVER-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-RECOVER-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[HANDLER_ALIGNMENT_ASSUMPTION:%.*]], !prof [[PROF3:![0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER: handler.alignment_assumption:
+// CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_alignment_assumption(ptr @[[GLOB1:[0-9]+]], i64 [[TMP1]], i64 128, i64 0) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER-NEXT: br label [[CONT]], !nosanitize !2
+// CHECK-SANITIZE-RECOVER: cont:
+// CHECK-SANITIZE-RECOVER-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 128) ]
+// CHECK-SANITIZE-RECOVER-NEXT: ret ptr [[CALL]]
+//
+// CHECK-SANITIZE-TRAP-LABEL: define dso_local noundef ptr @_Z6callerPPc
+// CHECK-SANITIZE-TRAP-SAME: (ptr noundef [[X:%.*]]) #[[ATTR0]] {
+// CHECK-SANITIZE-TRAP-NEXT: entry:
+// CHECK-SANITIZE-TRAP-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-SANITIZE-TRAP-NEXT: store ptr [[X]], ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR]], align 8
+// CHECK-SANITIZE-TRAP-NEXT: [[CALL:%.*]] = call noundef ptr @_Z11passthroughPPcm(ptr noundef [[TMP0]], i64 noundef 128)
+// CHECK-SANITIZE-TRAP-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[CALL]] to i64
+// CHECK-SANITIZE-TRAP-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 127
+// CHECK-SANITIZE-TRAP-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
+// CHECK-SANITIZE-TRAP-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[CALL]] to i64, !nosanitize !2
+// CHECK-SANITIZE-TRAP-NEXT: br i1 [[MASKCOND]], label [[CONT:%.*]], label [[TRAP:%.*]], !nosanitize !2
+// CHECK-SANITIZE-TRAP: trap:
+// CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 23) #[[ATTR3:[0-9]+]], !nosanitize !2
+// CHECK-SANITIZE-TRAP-NEXT: unreachable, !nosanitize !2
+// CHECK-SANITIZE-TRAP: cont:
+// CHECK-SANITIZE-TRAP-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 128) ]
+// CHECK-SANITIZE-TRAP-NEXT: ret ptr [[CALL]]
+//
char **caller(char **x) {
- // CHECK: define{{.*}} ptr @{{.*}}(ptr noundef %[[X:.*]])
- // CHECK-NEXT: entry:
- // CHECK-NEXT: %[[X_ADDR:.*]] = alloca ptr, align 8
- // CHECK-NEXT: store ptr %[[X]], ptr %[[X_ADDR]], align 8
- // CHECK-NEXT: %[[X_RELOADED:.*]] = load ptr, ptr %[[X_ADDR]], align 8
- // CHECK-NOSANITIZE-NEXT: %[[X_RETURNED:.*]] = call noundef align 128 ptr @[[PASSTHROUGH]](ptr noundef %[[X_RELOADED]], i64 noundef 128)
- // CHECK-SANITIZE-NEXT: %[[X_RETURNED:.*]] = call noundef ptr @[[PASSTHROUGH]](ptr noundef %[[X_RELOADED]], i64 noundef 128)
- // CHECK-SANITIZE-NEXT: %[[PTRINT:.*]] = ptrtoint ptr %[[X_RETURNED]] to i64
- // CHECK-SANITIZE-NEXT: %[[MASKEDPTR:.*]] = and i64 %[[PTRINT]], 127
- // CHECK-SANITIZE-NEXT: %[[MASKCOND:.*]] = icmp eq i64 %[[MASKEDPTR]], 0
- // CHECK-SANITIZE-NEXT: %[[PTRINT_DUP:.*]] = ptrtoint ptr %[[X_RETURNED]] to i64, !nosanitize
- // CHECK-SANITIZE-NEXT: br i1 %[[MASKCOND]], label %[[CONT:.*]], label %[[HANDLER_ALIGNMENT_ASSUMPTION:[^,]+]],{{.*}} !nosanitize
- // CHECK-SANITIZE: [[HANDLER_ALIGNMENT_ASSUMPTION]]:
- // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_alignment_assumption_abort(ptr @[[LINE_100_ALIGNMENT_ASSUMPTION]], i64 %[[PTRINT_DUP]], i64 128, i64 0){{.*}}, !nosanitize
- // CHECK-SANITIZE-RECOVER-NEXT: call void @__ubsan_handle_alignment_assumption(ptr @[[LINE_100_ALIGNMENT_ASSUMPTION]], i64 %[[PTRINT_DUP]], i64 128, i64 0){{.*}}, !nosanitize
- // CHECK-SANITIZE-TRAP-NEXT: call void @llvm.ubsantrap(i8 23){{.*}}, !nosanitize
- // CHECK-SANITIZE-UNREACHABLE-NEXT: unreachable, !nosanitize
- // CHECK-SANITIZE: [[CONT]]:
- // CHECK-SANITIZE-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr %[[X_RETURNED]], i64 128) ]
- // CHECK-NEXT: ret ptr %[[X_RETURNED]]
- // CHECK-NEXT: }
#line 100
return passthrough(x, 128);
}
More information about the cfe-commits
mailing list