diff --git a/llvm/unittests/Analysis/IVDescriptorsTest.cpp b/llvm/unittests/Analysis/IVDescriptorsTest.cpp index fd9a5a801042c..83bedc9bfe55d 100644 --- a/llvm/unittests/Analysis/IVDescriptorsTest.cpp +++ b/llvm/unittests/Analysis/IVDescriptorsTest.cpp @@ -52,14 +52,14 @@ TEST(IVDescriptorsTest, LoopWithSingleLatch) { std::unique_ptr M = parseIR( Context, - R"(define void @foo(i32* %A, i32 %ub) { + R"(define void @foo(ptr %A, i32 %ub) { entry: br label %for.body for.body: %i = phi i32 [ 0, %entry ], [ %inc, %for.body ] %idxprom = sext i32 %i to i64 - %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom - store i32 %i, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom + store i32 %i, ptr %arrayidx, align 4 %inc = add nsw i32 %i, 1 %cmp = icmp slt i32 %inc, %ub br i1 %cmp, label %for.body, label %for.exit @@ -97,47 +97,6 @@ for.end: }); } -TEST(IVDescriptorsTest, LoopWithScalableTypes) { - // Parse the module. - LLVMContext Context; - - std::unique_ptr M = - parseIR(Context, - R"(define void @foo(* %ptr) { -entry: - br label %for.body - -for.body: - %lsr.iv1 = phi * [ %0, %for.body ], [ %ptr, %entry ] - %j.0117 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %lsr.iv12 = bitcast * %lsr.iv1 to i8* - %inc = add nuw nsw i64 %j.0117, 1 - %uglygep = getelementptr i8, i8* %lsr.iv12, i64 4 - %0 = bitcast i8* %uglygep to * - %cmp = icmp ne i64 %inc, 1024 - br i1 %cmp, label %for.body, label %end - -end: - ret void -})"); - - runWithLoopInfoAndSE( - *M, "foo", [&](Function &F, LoopInfo &LI, ScalarEvolution &SE) { - Function::iterator FI = F.begin(); - // First basic block is entry - skip it. - BasicBlock *Header = &*(++FI); - assert(Header->getName() == "for.body"); - Loop *L = LI.getLoopFor(Header); - EXPECT_NE(L, nullptr); - PHINode *Inst_iv = dyn_cast(&Header->front()); - assert(Inst_iv->getName() == "lsr.iv1"); - InductionDescriptor IndDesc; - bool IsInductionPHI = - InductionDescriptor::isInductionPHI(Inst_iv, L, &SE, IndDesc); - EXPECT_FALSE(IsInductionPHI); - }); -} - // Depending on how SCEV deals with ptrtoint cast, the step of a phi could be // a pointer, and InductionDescriptor used to fail with an assertion. // So just check that it doesn't assert. @@ -152,10 +111,10 @@ TEST(IVDescriptorsTest, LoopWithPtrToInt) { declare void @widget() declare void @wobble(i32) - define void @barney(i8* %arg, i8* %arg18, i32 %arg19) { + define void @barney(ptr %arg, ptr %arg18, i32 %arg19) { bb: - %tmp = ptrtoint i8* %arg to i32 - %tmp20 = ptrtoint i8* %arg18 to i32 + %tmp = ptrtoint ptr %arg to i32 + %tmp20 = ptrtoint ptr %arg18 to i32 %tmp21 = or i32 %tmp20, %tmp %tmp22 = and i32 %tmp21, 3 %tmp23 = icmp eq i32 %tmp22, 0 @@ -211,15 +170,15 @@ TEST(IVDescriptorsTest, FMinRednIdentity) { LLVMContext Context; std::unique_ptr M = parseIR(Context, - R"(define float @foo(float* %A, i64 %ub) { + R"(define float @foo(ptr %A, i64 %ub) { entry: br label %for.body for.body: %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] %fmin = phi float [ 1.000000e+00, %entry ], [ %fmin.next, %for.body ] - %arrayidx = getelementptr inbounds float, float* %A, i64 %i - %ld = load float, float* %arrayidx + %arrayidx = getelementptr inbounds float, ptr %A, i64 %i + %ld = load float, ptr %arrayidx %fmin.cmp = fcmp nnan nsz olt float %fmin, %ld %fmin.next = select nnan nsz i1 %fmin.cmp, float %fmin, float %ld %i.next = add nsw i64 %i, 1 @@ -263,15 +222,15 @@ TEST(IVDescriptorsTest, FMaxRednIdentity) { LLVMContext Context; std::unique_ptr M = parseIR(Context, - R"(define float @foo(float* %A, i64 %ub) { + R"(define float @foo(ptr %A, i64 %ub) { entry: br label %for.body for.body: %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] %fmax = phi float [ 1.000000e+00, %entry ], [ %fmax.next, %for.body ] - %arrayidx = getelementptr inbounds float, float* %A, i64 %i - %ld = load float, float* %arrayidx + %arrayidx = getelementptr inbounds float, ptr %A, i64 %i + %ld = load float, ptr %arrayidx %fmax.cmp = fcmp nnan nsz ogt float %fmax, %ld %fmax.next = select nnan nsz i1 %fmax.cmp, float %fmax, float %ld %i.next = add nsw i64 %i, 1