1010; RUN: opt < %s -passes='bounds-checking<min-rt-abort>' -S | FileCheck %s --check-prefixes=MINRTABORT-NOMERGE
1111;
1212; RUN: opt < %s -passes='bounds-checking<trap;guard=3>' -S | FileCheck %s --check-prefixes=TR-GUARD
13- ; RUN: opt < %s -passes='bounds-checking<rt;guard=-5>' -S | FileCheck %s --check-prefixes=RT-GUARDRT
13+ ; RUN: opt < %s -passes='bounds-checking<rt;guard=-5>' -S | FileCheck %s --check-prefixes=RT-GUARD
1414target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
1515
1616define void @f1 (i64 %x ) nounwind {
@@ -144,23 +144,23 @@ define void @f1(i64 %x) nounwind {
144144; TR-GUARD-NEXT: call void @llvm.ubsantrap(i8 3) #[[ATTR3:[0-9]+]], !nosanitize [[META0]]
145145; TR-GUARD-NEXT: unreachable, !nosanitize [[META0]]
146146;
147- ; RT-GUARDRT -LABEL: define void @f1(
148- ; RT-GUARDRT -SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
149- ; RT-GUARDRT -NEXT: [[TMP1:%.*]] = mul i64 16, [[X]]
150- ; RT-GUARDRT -NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8
151- ; RT-GUARDRT -NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0, !nosanitize [[META0:![0-9]+]]
152- ; RT-GUARDRT -NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16, !nosanitize [[META0]]
153- ; RT-GUARDRT -NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]], !nosanitize [[META0]]
154- ; RT-GUARDRT -NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]], !nosanitize [[META0]]
155- ; RT-GUARDRT -NEXT: [[TMP7:%.*]] = call i1 @llvm.allow.ubsan.check(i8 -5), !nosanitize [[META0]]
156- ; RT-GUARDRT -NEXT: [[TMP8:%.*]] = and i1 [[TMP6]], [[TMP7]], !nosanitize [[META0]]
157- ; RT-GUARDRT -NEXT: br i1 [[TMP8]], label %[[TRAP:.*]], label %[[BB9:.*]]
158- ; RT-GUARDRT : [[BB9]]:
159- ; RT-GUARDRT -NEXT: [[TMP10:%.*]] = load i128, ptr [[TMP2]], align 4
160- ; RT-GUARDRT -NEXT: ret void
161- ; RT-GUARDRT : [[TRAP]]:
162- ; RT-GUARDRT -NEXT: call void @__ubsan_handle_local_out_of_bounds() #[[ATTR2:[0-9]+]], !nosanitize [[META0]]
163- ; RT-GUARDRT -NEXT: br label %[[BB9]], !nosanitize [[META0]]
147+ ; RT-GUARD -LABEL: define void @f1(
148+ ; RT-GUARD -SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
149+ ; RT-GUARD -NEXT: [[TMP1:%.*]] = mul i64 16, [[X]]
150+ ; RT-GUARD -NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8
151+ ; RT-GUARD -NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0, !nosanitize [[META0:![0-9]+]]
152+ ; RT-GUARD -NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16, !nosanitize [[META0]]
153+ ; RT-GUARD -NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]], !nosanitize [[META0]]
154+ ; RT-GUARD -NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]], !nosanitize [[META0]]
155+ ; RT-GUARD -NEXT: [[TMP7:%.*]] = call i1 @llvm.allow.ubsan.check(i8 -5), !nosanitize [[META0]]
156+ ; RT-GUARD -NEXT: [[TMP8:%.*]] = and i1 [[TMP6]], [[TMP7]], !nosanitize [[META0]]
157+ ; RT-GUARD -NEXT: br i1 [[TMP8]], label %[[TRAP:.*]], label %[[BB9:.*]]
158+ ; RT-GUARD : [[BB9]]:
159+ ; RT-GUARD -NEXT: [[TMP10:%.*]] = load i128, ptr [[TMP2]], align 4
160+ ; RT-GUARD -NEXT: ret void
161+ ; RT-GUARD : [[TRAP]]:
162+ ; RT-GUARD -NEXT: call void @__ubsan_handle_local_out_of_bounds() #[[ATTR2:[0-9]+]], !nosanitize [[META0]]
163+ ; RT-GUARD -NEXT: br label %[[BB9]], !nosanitize [[META0]]
164164;
165165 %1 = alloca i128 , i64 %x
166166 %3 = load i128 , ptr %1 , align 4
@@ -197,9 +197,9 @@ define void @f1(i64 %x) nounwind {
197197; TR-GUARD: attributes #[[ATTR2:[0-9]+]] = { cold noreturn nounwind }
198198; TR-GUARD: attributes #[[ATTR3]] = { nomerge noreturn nounwind }
199199;.
200- ; RT-GUARDRT : attributes #[[ATTR0]] = { nounwind }
201- ; RT-GUARDRT : attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
202- ; RT-GUARDRT : attributes #[[ATTR2]] = { nomerge nounwind }
200+ ; RT-GUARD : attributes #[[ATTR0]] = { nounwind }
201+ ; RT-GUARD : attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
202+ ; RT-GUARD : attributes #[[ATTR2]] = { nomerge nounwind }
203203;.
204204; TR: [[META0]] = !{}
205205;.
@@ -217,5 +217,5 @@ define void @f1(i64 %x) nounwind {
217217;.
218218; TR-GUARD: [[META0]] = !{}
219219;.
220- ; RT-GUARDRT : [[META0]] = !{}
220+ ; RT-GUARD : [[META0]] = !{}
221221;.
0 commit comments