From 78dc50e5a1a3a477ed80d3011eae59bc12562c3c Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 22 Nov 2021 14:29:01 -0500 Subject: [PATCH] [InstCombine] avoid 'tmp' usage in test files; NFC The update script ( utils/update_test_checks.py ) warns against this because it can conflict with the default FileCheck names given to anonymous values in the IR. --- llvm/test/Transforms/InstCombine/getelementptr.ll | 188 +++++++++++----------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index faa9bed..199cbca 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -146,14 +146,14 @@ define i32 @test9() { define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { ; CHECK-LABEL: @test10( -; CHECK-NEXT: [[TMP_4:%.*]] = icmp eq { i32, i32 }* [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: ret i1 [[TMP_4]] +; CHECK-NEXT: [[T4:%.*]] = icmp eq { i32, i32 }* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret i1 [[T4]] ; - %tmp.1 = getelementptr { i32, i32 }, { i32, i32 }* %x, i32 0, i32 1 - %tmp.3 = getelementptr { i32, i32 }, { i32, i32 }* %y, i32 0, i32 1 + %t1 = getelementptr { i32, i32 }, { i32, i32 }* %x, i32 0, i32 1 + %t3 = getelementptr { i32, i32 }, { i32, i32 }* %y, i32 0, i32 1 ;; seteq x, y - %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 - ret i1 %tmp.4 + %t4 = icmp eq i32* %t1, %t3 + ret i1 %t4 } define i1 @test11({ i32, i32 }* %X) { @@ -303,12 +303,12 @@ define i1 @test13_i128(i128 %X, %S* %P) { define i8* @test14(i32 %idx) { ; CHECK-LABEL: @test14( ; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[IDX:%.*]] to i64 -; CHECK-NEXT: [[TMP:%.*]] = getelementptr [3 x i8], [3 x i8]* @G, i64 0, i64 [[ZEXT]] -; CHECK-NEXT: ret i8* [[TMP]] +; CHECK-NEXT: [[T:%.*]] = getelementptr [3 x i8], [3 x i8]* @G, i64 0, i64 [[ZEXT]] +; CHECK-NEXT: ret i8* [[T]] ; %zext = zext i32 %idx to i64 - %tmp = getelementptr i8, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i64 %zext - ret i8* %tmp + %t = getelementptr i8, i8* getelementptr ([3 x i8], [3 x i8]* @G, i32 0, i32 0), i64 %zext + ret i8* %t } @@ -416,40 +416,40 @@ define i1 @test18_i128(i16* %P, i128 %I) { define i32 @test19(i32* %P, i32 %A, i32 %B) { ; CHECK-LABEL: @test19( -; CHECK-NEXT: [[TMP_10:%.*]] = icmp eq i32 [[A:%.*]], [[B:%.*]] -; CHECK-NEXT: [[TMP_11:%.*]] = zext i1 [[TMP_10]] to i32 -; CHECK-NEXT: ret i32 [[TMP_11]] +; CHECK-NEXT: [[T10:%.*]] = icmp eq i32 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[T11:%.*]] = zext i1 [[T10]] to i32 +; CHECK-NEXT: ret i32 [[T11]] ; - %tmp.4 = getelementptr inbounds i32, i32* %P, i32 %A - %tmp.9 = getelementptr inbounds i32, i32* %P, i32 %B - %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 - %tmp.11 = zext i1 %tmp.10 to i32 - ret i32 %tmp.11 + %t4 = getelementptr inbounds i32, i32* %P, i32 %A + %t9 = getelementptr inbounds i32, i32* %P, i32 %B + %t10 = icmp eq i32* %t4, %t9 + %t11 = zext i1 %t10 to i32 + ret i32 %t11 } define i32 @test20(i32* %P, i32 %A, i32 %B) { ; CHECK-LABEL: @test20( -; CHECK-NEXT: [[TMP_6:%.*]] = icmp eq i32 [[A:%.*]], 0 -; CHECK-NEXT: [[TMP_7:%.*]] = zext i1 [[TMP_6]] to i32 -; CHECK-NEXT: ret i32 [[TMP_7]] +; CHECK-NEXT: [[T6:%.*]] = icmp eq i32 [[A:%.*]], 0 +; CHECK-NEXT: [[T7:%.*]] = zext i1 [[T6]] to i32 +; CHECK-NEXT: ret i32 [[T7]] ; - %tmp.4 = getelementptr inbounds i32, i32* %P, i32 %A - %tmp.6 = icmp eq i32* %tmp.4, %P - %tmp.7 = zext i1 %tmp.6 to i32 - ret i32 %tmp.7 + %t4 = getelementptr inbounds i32, i32* %P, i32 %A + %t6 = icmp eq i32* %t4, %P + %t7 = zext i1 %t6 to i32 + ret i32 %t7 } define i32 @test20_as1(i32 addrspace(1)* %P, i32 %A, i32 %B) { ; CHECK-LABEL: @test20_as1( ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[A:%.*]] to i16 -; CHECK-NEXT: [[TMP_6:%.*]] = icmp eq i16 [[TMP1]], 0 -; CHECK-NEXT: [[TMP_7:%.*]] = zext i1 [[TMP_6]] to i32 -; CHECK-NEXT: ret i32 [[TMP_7]] +; CHECK-NEXT: [[T6:%.*]] = icmp eq i16 [[TMP1]], 0 +; CHECK-NEXT: [[T7:%.*]] = zext i1 [[T6]] to i32 +; CHECK-NEXT: ret i32 [[T7]] ; - %tmp.4 = getelementptr inbounds i32, i32 addrspace(1)* %P, i32 %A - %tmp.6 = icmp eq i32 addrspace(1)* %tmp.4, %P - %tmp.7 = zext i1 %tmp.6 to i32 - ret i32 %tmp.7 + %t4 = getelementptr inbounds i32, i32 addrspace(1)* %P, i32 %A + %t6 = icmp eq i32 addrspace(1)* %t4, %P + %t7 = zext i1 %t6 to i32 + ret i32 %t7 } @@ -500,14 +500,14 @@ define void @test25() { ; CHECK-NEXT: unreachable ; entry: - %tmp = getelementptr { i64, i64, i64, i64 }, { i64, i64, i64, i64 }* null, i32 0, i32 3 ; [#uses=1] - %tmp.upgrd.1 = load i64, i64* %tmp ; [#uses=1] - %tmp8.ui = load i64, i64* null ; [#uses=1] - %tmp8 = bitcast i64 %tmp8.ui to i64 ; [#uses=1] - %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; [#uses=1] - %sext = trunc i64 %tmp9 to i32 ; [#uses=1] - %tmp27.i = sext i32 %sext to i64 ; [#uses=1] - tail call void @foo25( i32 0, i64 %tmp27.i ) + %t = getelementptr { i64, i64, i64, i64 }, { i64, i64, i64, i64 }* null, i32 0, i32 3 + %t.upgrd.1 = load i64, i64* %t + %t8.ui = load i64, i64* null + %t8 = bitcast i64 %t8.ui to i64 + %t9 = and i64 %t8, %t.upgrd.1 + %sext = trunc i64 %t9 to i32 + %t27.i = sext i32 %sext to i64 + tail call void @foo25( i32 0, i64 %t27.i ) unreachable } @@ -534,25 +534,25 @@ define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { ; CHECK-LABEL: @test27( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[FROM_ADDR:%.*]] = alloca %struct.siginfo_t*, align 8 -; CHECK-NEXT: [[TMP344:%.*]] = load %struct.siginfo_t*, %struct.siginfo_t** [[FROM_ADDR]], align 8 -; CHECK-NEXT: [[TMP349:%.*]] = getelementptr [[STRUCT_SIGINFO_T:%.*]], %struct.siginfo_t* [[TMP344]], i64 0, i32 3, i32 0, i32 3, i32 0 -; CHECK-NEXT: [[TMP349350:%.*]] = bitcast i8** [[TMP349]] to i32* -; CHECK-NEXT: [[TMP351:%.*]] = load i32, i32* [[TMP349350]], align 8 -; CHECK-NEXT: [[TMP360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[TMP351]], %struct.__large_struct* null, i32 -14, i32 0) #[[ATTR0:[0-9]+]] +; CHECK-NEXT: [[T344:%.*]] = load %struct.siginfo_t*, %struct.siginfo_t** [[FROM_ADDR]], align 8 +; CHECK-NEXT: [[T349:%.*]] = getelementptr [[STRUCT_SIGINFO_T:%.*]], %struct.siginfo_t* [[T344]], i64 0, i32 3, i32 0, i32 3, i32 0 +; CHECK-NEXT: [[T349350:%.*]] = bitcast i8** [[T349]] to i32* +; CHECK-NEXT: [[T351:%.*]] = load i32, i32* [[T349350]], align 8 +; CHECK-NEXT: [[T360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[T351]], %struct.__large_struct* null, i32 -14, i32 0) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: unreachable ; entry: %from_addr = alloca %struct.siginfo_t* - %tmp344 = load %struct.siginfo_t*, %struct.siginfo_t** %from_addr, align 8 - %tmp345 = getelementptr %struct.siginfo_t, %struct.siginfo_t* %tmp344, i32 0, i32 3 - %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 - %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* - %tmp348 = getelementptr { i32, i32, %struct.sigval_t }, { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 - %tmp349 = getelementptr %struct.sigval_t, %struct.sigval_t* %tmp348, i32 0, i32 0 - %tmp349350 = bitcast i8** %tmp349 to i32* - %tmp351 = load i32, i32* %tmp349350, align 8 - %tmp360 = call i32 asm sideeffect "...", - "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, + %t344 = load %struct.siginfo_t*, %struct.siginfo_t** %from_addr, align 8 + %t345 = getelementptr %struct.siginfo_t, %struct.siginfo_t* %t344, i32 0, i32 3 + %t346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %t345, i32 0, i32 0 + %t346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %t346 to { i32, i32, %struct.sigval_t }* + %t348 = getelementptr { i32, i32, %struct.sigval_t }, { i32, i32, %struct.sigval_t }* %t346347, i32 0, i32 2 + %t349 = getelementptr %struct.sigval_t, %struct.sigval_t* %t348, i32 0, i32 0 + %t349350 = bitcast i8** %t349 to i32* + %t351 = load i32, i32* %t349350, align 8 + %t360 = call i32 asm sideeffect "...", + "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %t351, %struct.__large_struct* null, i32 -14, i32 0 ) unreachable } @@ -566,36 +566,36 @@ define i32 @test28() nounwind { ; CHECK-LABEL: @test28( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[ORIENTATIONS:%.*]] = alloca [1 x [1 x %struct.x]], align 8 -; CHECK-NEXT: [[TMP3:%.*]] = call i32 @puts(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)) #[[ATTR0]] +; CHECK-NEXT: [[T3:%.*]] = call i32 @puts(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)) #[[ATTR0]] ; CHECK-NEXT: br label [[BB10:%.*]] ; CHECK: bb10: ; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVAR_NEXT:%.*]], [[BB10]] ] -; CHECK-NEXT: [[TMP12_REC:%.*]] = xor i32 [[INDVAR]], -1 -; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[TMP12_REC]] to i64 -; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* [[ORIENTATIONS]], i64 1, i64 0, i64 [[TMP0]] -; CHECK-NEXT: [[TMP16:%.*]] = call i32 (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str1, i64 0, i64 0), %struct.x* nonnull [[TMP12]]) #[[ATTR0]] -; CHECK-NEXT: [[TMP84:%.*]] = icmp eq i32 [[INDVAR]], 0 +; CHECK-NEXT: [[T12_REC:%.*]] = xor i32 [[INDVAR]], -1 +; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[T12_REC]] to i64 +; CHECK-NEXT: [[T12:%.*]] = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* [[ORIENTATIONS]], i64 1, i64 0, i64 [[TMP0]] +; CHECK-NEXT: [[T16:%.*]] = call i32 (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str1, i64 0, i64 0), %struct.x* nonnull [[T12]]) #[[ATTR0]] +; CHECK-NEXT: [[T84:%.*]] = icmp eq i32 [[INDVAR]], 0 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 -; CHECK-NEXT: br i1 [[TMP84]], label [[BB17:%.*]], label [[BB10]] +; CHECK-NEXT: br i1 [[T84]], label [[BB17:%.*]], label [[BB10]] ; CHECK: bb17: ; CHECK-NEXT: ret i32 0 ; entry: %orientations = alloca [1 x [1 x %struct.x]] - %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8], [6 x i8]* @.str, i32 0, i32 0) ) nounwind - %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 + %t3 = call i32 @puts( i8* getelementptr ([6 x i8], [6 x i8]* @.str, i32 0, i32 0) ) nounwind + %t45 = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 %orientations62 = getelementptr [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 br label %bb10 bb10: %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] - %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 - %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 - %tmp12 = getelementptr inbounds %struct.x, %struct.x* %tmp45, i32 %tmp12.rec - %tmp16 = call i32 (i8*, ...) @printf( i8* nonnull dereferenceable(1) getelementptr ([12 x i8], [12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind - %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 + %t.0.reg2mem.0.rec = mul i32 %indvar, -1 + %t12.rec = add i32 %t.0.reg2mem.0.rec, -1 + %t12 = getelementptr inbounds %struct.x, %struct.x* %t45, i32 %t12.rec + %t16 = call i32 (i8*, ...) @printf( i8* nonnull dereferenceable(1) getelementptr ([12 x i8], [12 x i8]* @.str1, i32 0, i32 0), %struct.x* %t12 ) nounwind + %t84 = icmp eq %struct.x* %t12, %orientations62 %indvar.next = add i32 %indvar, 1 - br i1 %tmp84, label %bb17, label %bb10 + br i1 %t84, label %bb17, label %bb10 bb17: ret i32 0 @@ -621,10 +621,10 @@ define i32 @test29(i8* %start, i32 %X) nounwind { ; CHECK-NEXT: ret i32 0 ; entry: - %tmp3 = load i64, i64* null - %add.ptr = getelementptr i8, i8* %start, i64 %tmp3 - %tmp158 = load i32, i32* null - %add.ptr159 = getelementptr %T, %T* null, i32 %tmp158 + %t3 = load i64, i64* null + %add.ptr = getelementptr i8, i8* %start, i64 %t3 + %t158 = load i32, i32* null + %add.ptr159 = getelementptr %T, %T* null, i32 %t158 %add.ptr209 = getelementptr i8, i8* %start, i64 0 %add.ptr212 = getelementptr i8, i8* %add.ptr209, i32 %X %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr @@ -830,15 +830,15 @@ define void @pr10322_f1(%pr10322_t* %foo) { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds [[PR10322_T:%.*]], %pr10322_t* [[FOO:%.*]], i64 2 ; CHECK-NEXT: call void @pr10322_f2(%pr10322_t* nonnull [[ARRAYIDX8]]) #[[ATTR0]] -; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[PR10322_T]], %pr10322_t* [[ARRAYIDX8]], i64 0, i32 0 -; CHECK-NEXT: call void @pr10322_f3(i8** nonnull [[TMP2]]) #[[ATTR0]] +; CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[PR10322_T]], %pr10322_t* [[ARRAYIDX8]], i64 0, i32 0 +; CHECK-NEXT: call void @pr10322_f3(i8** nonnull [[T2]]) #[[ATTR0]] ; CHECK-NEXT: ret void ; entry: %arrayidx8 = getelementptr inbounds %pr10322_t, %pr10322_t* %foo, i64 2 call void @pr10322_f2(%pr10322_t* %arrayidx8) nounwind - %tmp2 = getelementptr inbounds %pr10322_t, %pr10322_t* %arrayidx8, i64 0, i32 0 - call void @pr10322_f3(i8** %tmp2) nounwind + %t2 = getelementptr inbounds %pr10322_t, %pr10322_t* %arrayidx8, i64 0, i32 0 + call void @pr10322_f3(i8** %t2) nounwind ret void } @@ -873,18 +873,18 @@ declare void @three_gep_h(%three_gep_t2*) define void @test39(%struct.ham* %arg, i8 %arg1) nounwind { ; CHECK-LABEL: @test39( -; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[STRUCT_HAM:%.*]], %struct.ham* [[ARG:%.*]], i64 0, i32 2 -; CHECK-NEXT: [[TMP1:%.*]] = bitcast %struct.zot** [[TMP]] to i8** -; CHECK-NEXT: [[TMP21:%.*]] = load i8*, i8** [[TMP1]], align 8 -; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, i8* [[TMP21]], i64 -8 -; CHECK-NEXT: store i8 [[ARG1:%.*]], i8* [[TMP4]], align 8 +; CHECK-NEXT: [[T:%.*]] = getelementptr inbounds [[STRUCT_HAM:%.*]], %struct.ham* [[ARG:%.*]], i64 0, i32 2 +; CHECK-NEXT: [[TMP1:%.*]] = bitcast %struct.zot** [[T]] to i8** +; CHECK-NEXT: [[T21:%.*]] = load i8*, i8** [[TMP1]], align 8 +; CHECK-NEXT: [[T4:%.*]] = getelementptr inbounds i8, i8* [[T21]], i64 -8 +; CHECK-NEXT: store i8 [[ARG1:%.*]], i8* [[T4]], align 8 ; CHECK-NEXT: ret void ; - %tmp = getelementptr inbounds %struct.ham, %struct.ham* %arg, i64 0, i32 2 - %tmp2 = load %struct.zot*, %struct.zot** %tmp, align 8 - %tmp3 = bitcast %struct.zot* %tmp2 to i8* - %tmp4 = getelementptr inbounds i8, i8* %tmp3, i64 -8 - store i8 %arg1, i8* %tmp4, align 8 + %t = getelementptr inbounds %struct.ham, %struct.ham* %arg, i64 0, i32 2 + %t2 = load %struct.zot*, %struct.zot** %t, align 8 + %t3 = bitcast %struct.zot* %t2 to i8* + %t4 = getelementptr inbounds i8, i8* %t3, i64 -8 + store i8 %arg1, i8* %t4, align 8 ret void } @@ -1172,13 +1172,13 @@ define i32 addrspace(1)* @ascast_0_0_gep([128 x i32]* %p) nounwind { define <2 x i32*> @PR32414(i32** %ptr) { ; CHECK-LABEL: @PR32414( -; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32** [[PTR:%.*]] to i32* -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], <2 x i64> -; CHECK-NEXT: ret <2 x i32*> [[TMP1]] +; CHECK-NEXT: [[T0:%.*]] = bitcast i32** [[PTR:%.*]] to i32* +; CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i32, i32* [[T0]], <2 x i64> +; CHECK-NEXT: ret <2 x i32*> [[T1]] ; - %tmp0 = bitcast i32** %ptr to i32* - %tmp1 = getelementptr inbounds i32, i32* %tmp0, <2 x i64> - ret <2 x i32*> %tmp1 + %t0 = bitcast i32** %ptr to i32* + %t1 = getelementptr inbounds i32, i32* %t0, <2 x i64> + ret <2 x i32*> %t1 } define i32* @test_bitcast_nzgep([1 x i32]* %base, i64 %idx) { -- 2.7.4