From 40a45bfe327cc420b7dcb537994ec03d17b505c2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 27 Nov 2022 16:02:31 -0500 Subject: [PATCH] PoisonChecking: Convert tests to opaque pointers --- .../Instrumentation/PoisonChecking/ub-checks.ll | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll b/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll index f40c805..fae262c 100644 --- a/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll +++ b/llvm/test/Instrumentation/PoisonChecking/ub-checks.ll @@ -5,75 +5,75 @@ ; a potential source of UB. The UB source is kept simple; we focus on the ; UB triggering instructions here. -define void @store(i8* %base, i32 %a) { +define void @store(ptr %base, i32 %a) { ; CHECK-LABEL: @store( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1 -; CHECK-NEXT: [[P:%.*]] = getelementptr i8, i8* [[BASE:%.*]], i32 [[ADD]] +; CHECK-NEXT: [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]] ; CHECK-NEXT: [[TMP3:%.*]] = xor i1 [[TMP2]], true ; CHECK-NEXT: call void @__poison_checker_assert(i1 [[TMP3]]) -; CHECK-NEXT: store i8 0, i8* [[P]] +; CHECK-NEXT: store i8 0, ptr [[P]] ; CHECK-NEXT: ret void ; %add = add nsw i32 %a, 1 - %p = getelementptr i8, i8* %base, i32 %add - store i8 0, i8* %p + %p = getelementptr i8, ptr %base, i32 %add + store i8 0, ptr %p ret void } -define void @load(i8* %base, i32 %a) { +define void @load(ptr %base, i32 %a) { ; CHECK-LABEL: @load( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1 -; CHECK-NEXT: [[P:%.*]] = getelementptr i8, i8* [[BASE:%.*]], i32 [[ADD]] +; CHECK-NEXT: [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]] ; CHECK-NEXT: [[TMP3:%.*]] = xor i1 [[TMP2]], true ; CHECK-NEXT: call void @__poison_checker_assert(i1 [[TMP3]]) -; CHECK-NEXT: [[TMP4:%.*]] = load volatile i8, i8* [[P]] +; CHECK-NEXT: [[TMP4:%.*]] = load volatile i8, ptr [[P]] ; CHECK-NEXT: ret void ; %add = add nsw i32 %a, 1 - %p = getelementptr i8, i8* %base, i32 %add - load volatile i8, i8* %p + %p = getelementptr i8, ptr %base, i32 %add + load volatile i8, ptr %p ret void } -define void @atomicrmw(i8* %base, i32 %a) { +define void @atomicrmw(ptr %base, i32 %a) { ; CHECK-LABEL: @atomicrmw( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1 -; CHECK-NEXT: [[P:%.*]] = getelementptr i8, i8* [[BASE:%.*]], i32 [[ADD]] +; CHECK-NEXT: [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]] ; CHECK-NEXT: [[TMP3:%.*]] = xor i1 [[TMP2]], true ; CHECK-NEXT: call void @__poison_checker_assert(i1 [[TMP3]]) -; CHECK-NEXT: [[TMP4:%.*]] = atomicrmw add i8* [[P]], i8 1 seq_cst +; CHECK-NEXT: [[TMP4:%.*]] = atomicrmw add ptr [[P]], i8 1 seq_cst ; CHECK-NEXT: ret void ; %add = add nsw i32 %a, 1 - %p = getelementptr i8, i8* %base, i32 %add - atomicrmw add i8* %p, i8 1 seq_cst + %p = getelementptr i8, ptr %base, i32 %add + atomicrmw add ptr %p, i8 1 seq_cst ret void } -define void @cmpxchg(i8* %base, i32 %a) { +define void @cmpxchg(ptr %base, i32 %a) { ; CHECK-LABEL: @cmpxchg( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[A]], 1 -; CHECK-NEXT: [[P:%.*]] = getelementptr i8, i8* [[BASE:%.*]], i32 [[ADD]] +; CHECK-NEXT: [[P:%.*]] = getelementptr i8, ptr [[BASE:%.*]], i32 [[ADD]] ; CHECK-NEXT: [[TMP3:%.*]] = xor i1 [[TMP2]], true ; CHECK-NEXT: call void @__poison_checker_assert(i1 [[TMP3]]) -; CHECK-NEXT: [[TMP4:%.*]] = cmpxchg i8* [[P]], i8 1, i8 0 seq_cst seq_cst +; CHECK-NEXT: [[TMP4:%.*]] = cmpxchg ptr [[P]], i8 1, i8 0 seq_cst seq_cst ; CHECK-NEXT: ret void ; %add = add nsw i32 %a, 1 - %p = getelementptr i8, i8* %base, i32 %add - cmpxchg i8* %p, i8 1, i8 0 seq_cst seq_cst + %p = getelementptr i8, ptr %base, i32 %add + cmpxchg ptr %p, i8 1, i8 0 seq_cst seq_cst ret void } -define i32 @udiv(i8* %base, i32 %a) { +define i32 @udiv(ptr %base, i32 %a) { ; CHECK-LABEL: @udiv( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 @@ -88,7 +88,7 @@ define i32 @udiv(i8* %base, i32 %a) { ret i32 %res } -define i32 @sdiv(i8* %base, i32 %a) { +define i32 @sdiv(ptr %base, i32 %a) { ; CHECK-LABEL: @sdiv( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 @@ -103,7 +103,7 @@ define i32 @sdiv(i8* %base, i32 %a) { ret i32 %res } -define i32 @urem(i8* %base, i32 %a) { +define i32 @urem(ptr %base, i32 %a) { ; CHECK-LABEL: @urem( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 @@ -118,7 +118,7 @@ define i32 @urem(i8* %base, i32 %a) { ret i32 %res } -define i32 @srem(i8* %base, i32 %a) { +define i32 @srem(ptr %base, i32 %a) { ; CHECK-LABEL: @srem( ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[A:%.*]], i32 1) ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1 -- 2.7.4