From bf4aeefed42647bfd828a7f0ba45eba6a9ff1ff8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 13 Dec 2022 15:20:13 +0100 Subject: [PATCH] [IndVarSimplify] Convert last test to opaque pointers (NFC) After addressing the SCEVExpander issue that caused me pause. Also delete a redundant test that is no longer needed. --- .../IndVarSimplify/lftr-opaque-pointers.ll | 42 ----- llvm/test/Transforms/IndVarSimplify/lftr.ll | 144 +++++++++--------- 2 files changed, 72 insertions(+), 114 deletions(-) delete mode 100644 llvm/test/Transforms/IndVarSimplify/lftr-opaque-pointers.ll diff --git a/llvm/test/Transforms/IndVarSimplify/lftr-opaque-pointers.ll b/llvm/test/Transforms/IndVarSimplify/lftr-opaque-pointers.ll deleted file mode 100644 index 3ce2e926461f2..0000000000000 --- a/llvm/test/Transforms/IndVarSimplify/lftr-opaque-pointers.ll +++ /dev/null @@ -1,42 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -passes=indvars -opaque-pointers < %s | FileCheck %s - -target datalayout = "n8:16:32:64" - -@data = common global [240 x i8] zeroinitializer, align 16 - -; Based on the test from lftr.ll -define void @test_zext(ptr %a) { -; CHECK-LABEL: @test_zext( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[LOOP:%.*]] -; CHECK: loop: -; CHECK-NEXT: [[P_0:%.*]] = phi ptr [ @data, [[ENTRY:%.*]] ], [ [[T3:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[DOT0:%.*]] = phi ptr [ [[A:%.*]], [[ENTRY]] ], [ [[T:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[T]] = getelementptr inbounds i8, ptr [[DOT0]], i64 1 -; CHECK-NEXT: [[T2:%.*]] = load i8, ptr [[DOT0]], align 1 -; CHECK-NEXT: [[T3]] = getelementptr inbounds i8, ptr [[P_0]], i64 1 -; CHECK-NEXT: store i8 [[T2]], ptr [[P_0]], align 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne ptr [[P_0]], getelementptr inbounds ([240 x i8], ptr @data, i64 0, i64 239) -; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]] -; CHECK: exit: -; CHECK-NEXT: ret void -; -entry: - br label %loop - -loop: - %i.0 = phi i8 [ 0, %entry ], [ %t4, %loop ] - %p.0 = phi ptr [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %t3, %loop ] - %.0 = phi ptr [ %a, %entry ], [ %t, %loop ] - %t = getelementptr inbounds i8, ptr %.0, i64 1 - %t2 = load i8, ptr %.0, align 1 - %t3 = getelementptr inbounds i8, ptr %p.0, i64 1 - store i8 %t2, ptr %p.0, align 1 - %t4 = add i8 %i.0, 1 - %t5 = icmp ult i8 %t4, -16 - br i1 %t5, label %loop, label %exit - -exit: - ret void -} diff --git a/llvm/test/Transforms/IndVarSimplify/lftr.ll b/llvm/test/Transforms/IndVarSimplify/lftr.ll index 3a6fc8c7673cd..41db925de577e 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr.ll @@ -14,7 +14,7 @@ define i32 @pre_to_post_add() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1 -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[I_NEXT]], 1001 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]] ; CHECK: loopexit: @@ -26,7 +26,7 @@ entry: loop: %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] %i.next = add i32 %i, 1 - store i32 %i, i32* @A + store i32 %i, ptr @A %c = icmp slt i32 %i, 1000 br i1 %c, label %loop, label %loopexit @@ -42,7 +42,7 @@ define i32 @pre_to_post_sub() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 1000, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = sub nsw i32 [[I]], 1 -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[C:%.*]] = icmp ugt i32 [[I]], 0 ; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[LOOPEXIT:%.*]] ; CHECK: loopexit: @@ -54,7 +54,7 @@ entry: loop: %i = phi i32 [ 1000, %entry ], [ %i.next, %loop ] %i.next = sub i32 %i, 1 - store i32 %i, i32* @A + store i32 %i, ptr @A %c = icmp sgt i32 %i, 0 br i1 %c, label %loop, label %loopexit @@ -73,7 +73,7 @@ define i32 @quadratic_slt() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 7, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1 -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[I_NEXT]], 33 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]] ; CHECK: loopexit: @@ -85,7 +85,7 @@ entry: loop: %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] %i.next = add i32 %i, 1 - store i32 %i, i32* @A + store i32 %i, ptr @A %i2 = mul i32 %i, %i %c = icmp slt i32 %i2, 1000 br i1 %c, label %loop, label %loopexit @@ -103,7 +103,7 @@ define i32 @quadratic_sle() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 7, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1 -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[I_NEXT]], 33 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]] ; CHECK: loopexit: @@ -115,7 +115,7 @@ entry: loop: %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] %i.next = add i32 %i, 1 - store i32 %i, i32* @A + store i32 %i, ptr @A %i2 = mul i32 %i, %i %c = icmp sle i32 %i2, 1000 br i1 %c, label %loop, label %loopexit @@ -132,7 +132,7 @@ define i32 @quadratic_ule() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 7, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i32 [[I]], 1 -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[I_NEXT]], 33 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]] ; CHECK: loopexit: @@ -144,7 +144,7 @@ entry: loop: %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] %i.next = add i32 %i, 1 - store i32 %i, i32* @A + store i32 %i, ptr @A %i2 = mul i32 %i, %i %c = icmp ule i32 %i2, 1000 br i1 %c, label %loop, label %loopexit @@ -160,7 +160,7 @@ define i32 @quadratic_sgt_loopdec() { ; CHECK: loop: ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 10, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[I_NEXT]] = call i32 @llvm.loop.decrement.reg.i32(i32 [[I]], i32 1) -; CHECK-NEXT: store i32 [[I]], i32* @A, align 4 +; CHECK-NEXT: store i32 [[I]], ptr @A, align 4 ; CHECK-NEXT: [[I2:%.*]] = mul i32 [[I]], [[I]] ; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 [[I2]], 0 ; CHECK-NEXT: br i1 [[C]], label [[LOOP]], label [[LOOPEXIT:%.*]] @@ -174,7 +174,7 @@ entry: loop: %i = phi i32 [ 10, %entry ], [ %i.next, %loop ] %i.next = call i32 @llvm.loop.decrement.reg.i32(i32 %i, i32 1) - store i32 %i, i32* @A + store i32 %i, ptr @A %i2 = mul i32 %i, %i %c = icmp sgt i32 %i2, 0 br i1 %c, label %loop, label %loopexit @@ -185,18 +185,18 @@ loopexit: @data = common global [240 x i8] zeroinitializer, align 16 -define void @test_zext(i8* %a) #0 { +define void @test_zext(ptr %a) #0 { ; CHECK-LABEL: @test_zext( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[T3:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[DOT0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[T:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[T]] = getelementptr inbounds i8, i8* [[DOT0]], i64 1 -; CHECK-NEXT: [[T2:%.*]] = load i8, i8* [[DOT0]], align 1 -; CHECK-NEXT: [[T3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1 -; CHECK-NEXT: store i8 [[T2]], i8* [[P_0]], align 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[P_0]], getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 239) +; CHECK-NEXT: [[P_0:%.*]] = phi ptr [ @data, [[ENTRY:%.*]] ], [ [[T3:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[DOT0:%.*]] = phi ptr [ [[A:%.*]], [[ENTRY]] ], [ [[T:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[T]] = getelementptr inbounds i8, ptr [[DOT0]], i64 1 +; CHECK-NEXT: [[T2:%.*]] = load i8, ptr [[DOT0]], align 1 +; CHECK-NEXT: [[T3]] = getelementptr inbounds i8, ptr [[P_0]], i64 1 +; CHECK-NEXT: store i8 [[T2]], ptr [[P_0]], align 1 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne ptr [[P_0]], getelementptr inbounds ([240 x i8], ptr @data, i64 0, i64 239) ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -206,12 +206,12 @@ entry: loop: %i.0 = phi i8 [ 0, %entry ], [ %t4, %loop ] - %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %t3, %loop ] - %.0 = phi i8* [ %a, %entry ], [ %t, %loop ] - %t = getelementptr inbounds i8, i8* %.0, i64 1 - %t2 = load i8, i8* %.0, align 1 - %t3 = getelementptr inbounds i8, i8* %p.0, i64 1 - store i8 %t2, i8* %p.0, align 1 + %p.0 = phi ptr [ @data, %entry ], [ %t3, %loop ] + %.0 = phi ptr [ %a, %entry ], [ %t, %loop ] + %t = getelementptr inbounds i8, ptr %.0, i64 1 + %t2 = load i8, ptr %.0, align 1 + %t3 = getelementptr inbounds i8, ptr %p.0, i64 1 + store i8 %t2, ptr %p.0, align 1 %t4 = add i8 %i.0, 1 %t5 = icmp ult i8 %t4, -16 br i1 %t5, label %loop, label %exit @@ -223,7 +223,7 @@ exit: ; It is okay to do LFTR on this loop even though the trip count is a ; division because in this case the division can be optimized to a ; shift. -define void @test_udiv_as_shift(i8* %a, i8 %n) nounwind uwtable ssp { +define void @test_udiv_as_shift(ptr %a, i8 %n) nounwind uwtable ssp { ; CHECK-LABEL: @test_udiv_as_shift( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[E:%.*]] = icmp sgt i8 [[N:%.*]], 3 @@ -236,7 +236,7 @@ define void @test_udiv_as_shift(i8* %a, i8 %n) nounwind uwtable ssp { ; CHECK: loop: ; CHECK-NEXT: [[I1:%.*]] = phi i8 [ [[I1_INC:%.*]], [[LOOP]] ], [ 0, [[LOOP_PREHEADER]] ] ; CHECK-NEXT: [[I1_INC]] = add nuw nsw i8 [[I1]], 1 -; CHECK-NEXT: store volatile i8 0, i8* [[A:%.*]], align 1 +; CHECK-NEXT: store volatile i8 0, ptr [[A:%.*]], align 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[I1_INC]], [[TMP2]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]] ; CHECK: exit.loopexit: @@ -253,7 +253,7 @@ loop: %i1 = phi i8 [ 0, %entry ], [ %i1.inc, %loop ] %i.inc = add nsw i8 %i, 4 %i1.inc = add i8 %i1, 1 - store volatile i8 0, i8* %a + store volatile i8 0, ptr %a %c = icmp slt i8 %i, %n br i1 %c, label %loop, label %exit @@ -296,7 +296,7 @@ loopexit.0: ; preds = %loopentry.0 } @.str3 = private constant [6 x i8] c"%lld\0A\00", align 1 -declare i32 @printf(i8* noalias nocapture, ...) nounwind +declare i32 @printf(ptr noalias nocapture, ...) nounwind ; PR13371: indvars pass incorrectly substitutes 'undef' values ; @@ -309,7 +309,7 @@ define i64 @no_undef_counter() nounwind { ; CHECK-NEXT: [[UNDEF:%.*]] = phi i64 [ [[NEXT_UNDEF:%.*]], [[BLOCK9]] ], [ undef, [[FUNC_START:%.*]] ] ; CHECK-NEXT: [[ITER:%.*]] = phi i64 [ [[NEXT_ITER:%.*]], [[BLOCK9]] ], [ 1, [[FUNC_START]] ] ; CHECK-NEXT: [[NEXT_ITER]] = add nuw nsw i64 [[ITER]], 1 -; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 [[NEXT_ITER]], i64 [[UNDEF]]) +; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 (ptr, ...) @printf(ptr noalias nocapture @.str3, i64 [[NEXT_ITER]], i64 [[UNDEF]]) ; CHECK-NEXT: [[NEXT_UNDEF]] = add nsw i64 [[UNDEF]], 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[NEXT_ITER]], 100 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[BLOCK9]], label [[EXIT:%.*]] @@ -322,7 +322,7 @@ block9: ; preds = %block9,%func_start %undef = phi i64 [ %next_undef, %block9 ], [ undef, %func_start ] %iter = phi i64 [ %next_iter, %block9 ], [ 1, %func_start ] %next_iter = add nsw i64 %iter, 1 - %0 = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 %next_iter, i64 %undef) + %0 = tail call i32 (ptr, ...) @printf(ptr noalias nocapture @.str3, i64 %next_iter, i64 %undef) %next_undef = add nsw i64 %undef, 1 %_tmp_3 = icmp slt i64 %next_iter, 100 br i1 %_tmp_3, label %block9, label %exit @@ -394,7 +394,7 @@ attributes #1 = { nounwind } ; With the given initial value for IV, it is not legal to widen ; trip count to IV size -define void @wide_trip_count_test1(float* %autoc, +define void @wide_trip_count_test1(ptr %autoc, ; CHECK-LABEL: @wide_trip_count_test1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SUB:%.*]] = sub i32 [[DATA_LEN:%.*]], [[SAMPLE:%.*]] @@ -407,13 +407,13 @@ define void @wide_trip_count_test1(float* %autoc, ; CHECK-NEXT: [[TEMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[TEMP]], [[SAMPLE]] ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[ADD]] to i64 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[DATA:%.*]], i64 [[IDXPROM]] -; CHECK-NEXT: [[TEMP1:%.*]] = load float, float* [[ARRAYIDX]], align 4 +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[DATA:%.*]], i64 [[IDXPROM]] +; CHECK-NEXT: [[TEMP1:%.*]] = load float, ptr [[ARRAYIDX]], align 4 ; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TEMP1]], [[D:%.*]] -; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, float* [[AUTOC:%.*]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TEMP2:%.*]] = load float, float* [[ARRAYIDX2]], align 4 +; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[AUTOC:%.*]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TEMP2:%.*]] = load float, ptr [[ARRAYIDX2]], align 4 ; CHECK-NEXT: [[ADD3:%.*]] = fadd float [[TEMP2]], [[MUL]] -; CHECK-NEXT: store float [[ADD3]], float* [[ARRAYIDX2]], align 4 +; CHECK-NEXT: store float [[ADD3]], ptr [[ARRAYIDX2]], align 4 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 ; CHECK-NEXT: [[LFTR_WIDEIV:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i32 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[LFTR_WIDEIV]], [[SUB]] @@ -423,7 +423,7 @@ define void @wide_trip_count_test1(float* %autoc, ; CHECK: for.end: ; CHECK-NEXT: ret void ; - float* %data, + ptr %data, float %d, i32 %data_len, i32 %sample) nounwind { entry: %sub = sub i32 %data_len, %sample @@ -435,13 +435,13 @@ for.body: ; preds = %entry, %for.body %temp = trunc i64 %indvars.iv to i32 %add = add i32 %temp, %sample %idxprom = zext i32 %add to i64 - %arrayidx = getelementptr inbounds float, float* %data, i64 %idxprom - %temp1 = load float, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %data, i64 %idxprom + %temp1 = load float, ptr %arrayidx, align 4 %mul = fmul float %temp1, %d - %arrayidx2 = getelementptr inbounds float, float* %autoc, i64 %indvars.iv - %temp2 = load float, float* %arrayidx2, align 4 + %arrayidx2 = getelementptr inbounds float, ptr %autoc, i64 %indvars.iv + %temp2 = load float, ptr %arrayidx2, align 4 %add3 = fadd float %temp2, %mul - store float %add3, float* %arrayidx2, align 4 + store float %add3, ptr %arrayidx2, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 %temp3 = trunc i64 %indvars.iv.next to i32 %cmp = icmp ult i32 %temp3, %sub @@ -452,7 +452,7 @@ for.end: ; preds = %for.body, %entry } ; Trip count should be widened and LFTR should canonicalize the condition -define float @wide_trip_count_test2(float* %a, +define float @wide_trip_count_test2(ptr %a, ; CHECK-LABEL: @wide_trip_count_test2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[M:%.*]], 500 @@ -463,10 +463,10 @@ define float @wide_trip_count_test2(float* %a, ; CHECK: for.body: ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 500, [[FOR_BODY_PREHEADER]] ] ; CHECK-NEXT: [[SUM_07:%.*]] = phi float [ [[ADD:%.*]], [[FOR_BODY]] ], [ 0.000000e+00, [[FOR_BODY_PREHEADER]] ] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TEMP:%.*]] = load float, float* [[ARRAYIDX]], align 4 -; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TEMP1:%.*]] = load float, float* [[ARRAYIDX2]], align 4 +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TEMP:%.*]] = load float, ptr [[ARRAYIDX]], align 4 +; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TEMP1:%.*]] = load float, ptr [[ARRAYIDX2]], align 4 ; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TEMP]], [[TEMP1]] ; CHECK-NEXT: [[ADD]] = fadd float [[SUM_07]], [[MUL]] ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 @@ -479,7 +479,7 @@ define float @wide_trip_count_test2(float* %a, ; CHECK-NEXT: [[SUM_0_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[ADD_LCSSA]], [[FOR_END_LOOPEXIT]] ] ; CHECK-NEXT: ret float [[SUM_0_LCSSA]] ; - float* %b, + ptr %b, i32 zeroext %m) local_unnamed_addr #0 { entry: %cmp5 = icmp ugt i32 %m, 500 @@ -492,10 +492,10 @@ for.body: ; preds = %for.body.preheader, %sum.07 = phi float [ %add, %for.body ], [ 0.000000e+00, %for.body.preheader ] %i.06 = phi i32 [ %inc, %for.body ], [ 500, %for.body.preheader ] %idxprom = zext i32 %i.06 to i64 - %arrayidx = getelementptr inbounds float, float* %b, i64 %idxprom - %temp = load float, float* %arrayidx, align 4 - %arrayidx2 = getelementptr inbounds float, float* %a, i64 %idxprom - %temp1 = load float, float* %arrayidx2, align 4 + %arrayidx = getelementptr inbounds float, ptr %b, i64 %idxprom + %temp = load float, ptr %arrayidx, align 4 + %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %idxprom + %temp1 = load float, ptr %arrayidx2, align 4 %mul = fmul float %temp, %temp1 %add = fadd float %sum.07, %mul %inc = add i32 %i.06, 1 @@ -511,7 +511,7 @@ for.end: ; preds = %for.end.loopexit, % } ; Trip count should be widened and LFTR should canonicalize the condition -define float @wide_trip_count_test3(float* %b, +define float @wide_trip_count_test3(ptr %b, ; CHECK-LABEL: @wide_trip_count_test3( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP5:%.*]] = icmp sgt i32 [[M:%.*]], -10 @@ -523,8 +523,8 @@ define float @wide_trip_count_test3(float* %b, ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ -10, [[FOR_BODY_PREHEADER]] ] ; CHECK-NEXT: [[SUM_07:%.*]] = phi float [ [[ADD1:%.*]], [[FOR_BODY]] ], [ 0.000000e+00, [[FOR_BODY_PREHEADER]] ] ; CHECK-NEXT: [[TMP0:%.*]] = add nsw i64 [[INDVARS_IV]], 20 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TEMP:%.*]] = load float, float* [[ARRAYIDX]], align 4 +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TEMP:%.*]] = load float, ptr [[ARRAYIDX]], align 4 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV]] to i32 ; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP1]] to float ; CHECK-NEXT: [[MUL:%.*]] = fmul float [[CONV]], [[TEMP]] @@ -552,8 +552,8 @@ for.body: ; preds = %for.body.preheader, %i.06 = phi i32 [ %inc, %for.body ], [ -10, %for.body.preheader ] %add = add nsw i32 %i.06, 20 %idxprom = sext i32 %add to i64 - %arrayidx = getelementptr inbounds float, float* %b, i64 %idxprom - %temp = load float, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %b, i64 %idxprom + %temp = load float, ptr %arrayidx, align 4 %conv = sitofp i32 %i.06 to float %mul = fmul float %conv, %temp %add1 = fadd float %sum.07, %mul @@ -570,7 +570,7 @@ for.end: ; preds = %for.end.loopexit, % } ; Trip count should be widened and LFTR should canonicalize the condition -define float @wide_trip_count_test4(float* %b, +define float @wide_trip_count_test4(ptr %b, ; CHECK-LABEL: @wide_trip_count_test4( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP5:%.*]] = icmp sgt i32 [[M:%.*]], 10 @@ -582,8 +582,8 @@ define float @wide_trip_count_test4(float* %b, ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 10, [[FOR_BODY_PREHEADER]] ] ; CHECK-NEXT: [[SUM_07:%.*]] = phi float [ [[ADD1:%.*]], [[FOR_BODY]] ], [ 0.000000e+00, [[FOR_BODY_PREHEADER]] ] ; CHECK-NEXT: [[TMP0:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 20 -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 [[TMP0]] -; CHECK-NEXT: [[TEMP:%.*]] = load float, float* [[ARRAYIDX]], align 4 +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 [[TMP0]] +; CHECK-NEXT: [[TEMP:%.*]] = load float, ptr [[ARRAYIDX]], align 4 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV]] to i32 ; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP1]] to float ; CHECK-NEXT: [[MUL:%.*]] = fmul float [[CONV]], [[TEMP]] @@ -611,8 +611,8 @@ for.body: ; preds = %for.body.preheader, %i.06 = phi i32 [ %inc, %for.body ], [ 10, %for.body.preheader ] %add = add nsw i32 %i.06, 20 %idxprom = sext i32 %add to i64 - %arrayidx = getelementptr inbounds float, float* %b, i64 %idxprom - %temp = load float, float* %arrayidx, align 4 + %arrayidx = getelementptr inbounds float, ptr %b, i64 %idxprom + %temp = load float, ptr %arrayidx, align 4 %conv = sitofp i32 %i.06 to float %mul = fmul float %conv, %temp %add1 = fadd float %sum.07, %mul @@ -634,10 +634,10 @@ define void @ptr_non_cmp_exit_test() { ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[FOR_BODY29:%.*]] ; CHECK: for.body29: -; CHECK-NEXT: [[IV:%.*]] = phi i8* [ null, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY29]] ] -; CHECK-NEXT: [[TMP0:%.*]] = load volatile i8, i8* [[IV]], align 1 -; CHECK-NEXT: [[IV_NEXT]] = getelementptr inbounds i8, i8* [[IV]], i64 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[IV]], inttoptr (i64 10 to i8*) +; CHECK-NEXT: [[IV:%.*]] = phi ptr [ null, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY29]] ] +; CHECK-NEXT: [[TMP0:%.*]] = load volatile i8, ptr [[IV]], align 1 +; CHECK-NEXT: [[IV_NEXT]] = getelementptr inbounds i8, ptr [[IV]], i64 1 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne ptr [[IV]], inttoptr (i64 10 to ptr) ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY29]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -646,10 +646,10 @@ entry: br label %for.body29 for.body29: - %iv = phi i8* [ null, %entry ], [ %iv.next, %for.body29 ] - load volatile i8, i8* %iv, align 1 - %iv.next = getelementptr inbounds i8, i8* %iv, i64 1 - %cmp = icmp ne i8* %iv.next, inttoptr (i64 11 to i8*) + %iv = phi ptr [ null, %entry ], [ %iv.next, %for.body29 ] + load volatile i8, ptr %iv, align 1 + %iv.next = getelementptr inbounds i8, ptr %iv, i64 1 + %cmp = icmp ne ptr %iv.next, inttoptr (i64 11 to ptr) %and = and i1 %cmp, %cmp br i1 %and, label %for.body29, label %exit