diff --git a/llvm/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll b/llvm/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll index 70ab97350364c..778083e3ae03a 100644 --- a/llvm/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll +++ b/llvm/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll @@ -1,10 +1,10 @@ ; RUN: opt < %s -passes=instcombine -disable-output -@X = global i32 5 ; [#uses=1] +@X = global i32 5 ; [#uses=1] define i64 @test() { %C = add i64 1, 2 ; [#uses=1] - %V = add i64 ptrtoint (i32* @X to i64), %C ; [#uses=1] + %V = add i64 ptrtoint (ptr @X to i64), %C ; [#uses=1] ret i64 %V } diff --git a/llvm/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll b/llvm/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll index cb9243fed5565..d634224dd7b7b 100644 --- a/llvm/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll +++ b/llvm/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll @@ -14,31 +14,31 @@ ; END. target datalayout = "e-p:32:32" -@silly = external constant i32 ; [#uses=1] +@silly = external constant i32 ; [#uses=1] -declare void @bzero(i8*, i32) +declare void @bzero(ptr, i32) -declare void @bcopy(i8*, i8*, i32) +declare void @bcopy(ptr, ptr, i32) -declare i32 @bcmp(i8*, i8*, i32) +declare i32 @bcmp(ptr, ptr, i32) -declare i32 @fputs(i8*, i8*) +declare i32 @fputs(ptr, ptr) -declare i32 @fputs_unlocked(i8*, i8*) +declare i32 @fputs_unlocked(ptr, ptr) define i32 @function(i32 %a.1) { entry: - %a.0 = alloca i32 ; [#uses=2] - %result = alloca i32 ; [#uses=2] - store i32 %a.1, i32* %a.0 - %tmp.0 = load i32, i32* %a.0 ; [#uses=1] - %tmp.1 = load i32, i32* @silly ; [#uses=1] + %a.0 = alloca i32 ; [#uses=2] + %result = alloca i32 ; [#uses=2] + store i32 %a.1, ptr %a.0 + %tmp.0 = load i32, ptr %a.0 ; [#uses=1] + %tmp.1 = load i32, ptr @silly ; [#uses=1] %tmp.2 = add i32 %tmp.0, %tmp.1 ; [#uses=1] - store i32 %tmp.2, i32* %result + store i32 %tmp.2, ptr %result br label %return return: ; preds = %entry - %tmp.3 = load i32, i32* %result ; [#uses=1] + %tmp.3 = load i32, ptr %result ; [#uses=1] ret i32 %tmp.3 } diff --git a/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll index 027299ff2540c..e1309b9871dbe 100644 --- a/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll +++ b/llvm/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll @@ -7,12 +7,12 @@ declare i32 @bitmap_clear(...) define i32 @oof() { entry: - %live_head = alloca i32 ; [#uses=2] - %tmp.1 = icmp ne i32* %live_head, null ; [#uses=1] + %live_head = alloca i32 ; [#uses=2] + %tmp.1 = icmp ne ptr %live_head, null ; [#uses=1] br i1 %tmp.1, label %then, label %UnifiedExitNode then: ; preds = %entry - %tmp.4 = call i32 (...) @bitmap_clear( i32* %live_head ) ; [#uses=0] + %tmp.4 = call i32 (...) @bitmap_clear( ptr %live_head ) ; [#uses=0] br label %UnifiedExitNode UnifiedExitNode: ; preds = %then, %entry diff --git a/llvm/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll b/llvm/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll index f0dbc63deff9c..5cdea324c4bac 100644 --- a/llvm/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll +++ b/llvm/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -passes=instcombine -S | grep load -define void @test(i32* %P) { +define void @test(ptr %P) { ; Dead but not deletable! - %X = load volatile i32, i32* %P ; [#uses=0] + %X = load volatile i32, ptr %P ; [#uses=0] ret void } diff --git a/llvm/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll b/llvm/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll index 0f27110c7fc72..06af1443c24ae 100644 --- a/llvm/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll +++ b/llvm/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll @@ -1,18 +1,18 @@ ; RUN: opt < %s -passes=instcombine -disable-output -declare i32* @bar() +declare ptr @bar() -define float* @foo() personality i32 (...)* @__gxx_personality_v0 { - %tmp.11 = invoke float* bitcast (i32* ()* @bar to float* ()*)( ) - to label %invoke_cont unwind label %X ; [#uses=1] +define ptr @foo() personality ptr @__gxx_personality_v0 { + %tmp.11 = invoke ptr @bar( ) + to label %invoke_cont unwind label %X ; [#uses=1] invoke_cont: ; preds = %0 - ret float* %tmp.11 + ret ptr %tmp.11 X: ; preds = %0 - %exn = landingpad {i8*, i32} + %exn = landingpad {ptr, i32} cleanup - ret float* null + ret ptr null } declare i32 @__gxx_personality_v0(...) diff --git a/llvm/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll b/llvm/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll index fe9946cede17c..88f8f7849e9ea 100644 --- a/llvm/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll +++ b/llvm/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll @@ -6,8 +6,8 @@ target datalayout = "e-p:32:32" declare void @foo(...) define void @test(i64 %X) { - %Y = inttoptr i64 %X to i32* ; [#uses=1] - call void (...) @foo( i32* %Y ) + %Y = inttoptr i64 %X to ptr ; [#uses=1] + call void (...) @foo( ptr %Y ) ret void } diff --git a/llvm/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll b/llvm/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll index 214ce68eda74b..d68cbd8d15346 100644 --- a/llvm/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll +++ b/llvm/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll @@ -7,23 +7,23 @@ ; ; RUN: opt < %s -passes=instcombine -disable-output -declare i8* @test() +declare ptr @test() -define i32 @foo() personality i32 (...)* @__gxx_personality_v0 { +define i32 @foo() personality ptr @__gxx_personality_v0 { entry: br i1 true, label %cont, label %call call: ; preds = %entry - %P = invoke i32* bitcast (i8* ()* @test to i32* ()*)( ) - to label %cont unwind label %N ; [#uses=1] + %P = invoke ptr @test( ) + to label %cont unwind label %N ; [#uses=1] cont: ; preds = %call, %entry - %P2 = phi i32* [ %P, %call ], [ null, %entry ] ; [#uses=1] - %V = load i32, i32* %P2 ; [#uses=1] + %P2 = phi ptr [ %P, %call ], [ null, %entry ] ; [#uses=1] + %V = load i32, ptr %P2 ; [#uses=1] ret i32 %V N: ; preds = %call - %exn = landingpad {i8*, i32} + %exn = landingpad {ptr, i32} cleanup ret i32 0 } diff --git a/llvm/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll b/llvm/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll index 7648079b2ffb1..65c13345f7de5 100644 --- a/llvm/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll +++ b/llvm/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll @@ -2,9 +2,8 @@ %Ty = type opaque -define i32 @test(%Ty* %X) { - %Y = bitcast %Ty* %X to i32* ; [#uses=1] - %Z = load i32, i32* %Y ; [#uses=1] +define i32 @test(ptr %X) { + %Z = load i32, ptr %X ; [#uses=1] ret i32 %Z } diff --git a/llvm/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll b/llvm/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll index ad2226d8fc9e7..a9a07e3b0c63f 100644 --- a/llvm/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll +++ b/llvm/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -passes=instcombine -disable-output -@p = weak global i32 0 ; [#uses=1] +@p = weak global i32 0 ; [#uses=1] define i32 @test(i32 %x) { - %y = mul i32 %x, ptrtoint (i32* @p to i32) ; [#uses=1] + %y = mul i32 %x, ptrtoint (ptr @p to i32) ; [#uses=1] ret i32 %y } diff --git a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll index 10122e48ab664..20eb459ff1f44 100644 --- a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll +++ b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll @@ -6,13 +6,13 @@ ; so could produce incorrect results! define i32 @test(i1 %C) { - %X = alloca i32 ; [#uses=3] - %X2 = alloca i32 ; [#uses=2] - store i32 1, i32* %X - store i32 2, i32* %X2 - %Y = select i1 %C, i32* %X, i32* %X2 ; [#uses=1] - store i32 3, i32* %X - %Z = load i32, i32* %Y ; [#uses=1] + %X = alloca i32 ; [#uses=3] + %X2 = alloca i32 ; [#uses=2] + store i32 1, ptr %X + store i32 2, ptr %X2 + %Y = select i1 %C, ptr %X, ptr %X2 ; [#uses=1] + store i32 3, ptr %X + %Z = load i32, ptr %Y ; [#uses=1] ret i32 %Z } diff --git a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll index f711db0cb25e3..cb73d607467f1 100644 --- a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll +++ b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll @@ -6,19 +6,19 @@ define i32 @test(i1 %C) { entry: - %X = alloca i32 ; [#uses=3] - %X2 = alloca i32 ; [#uses=2] - store i32 1, i32* %X - store i32 2, i32* %X2 + %X = alloca i32 ; [#uses=3] + %X2 = alloca i32 ; [#uses=2] + store i32 1, ptr %X + store i32 2, ptr %X2 br i1 %C, label %cond_true.i, label %cond_continue.i cond_true.i: ; preds = %entry br label %cond_continue.i cond_continue.i: ; preds = %cond_true.i, %entry - %mem_tmp.i.0 = phi i32* [ %X, %cond_true.i ], [ %X2, %entry ] ; [#uses=1] - store i32 3, i32* %X - %tmp.3 = load i32, i32* %mem_tmp.i.0 ; [#uses=1] + %mem_tmp.i.0 = phi ptr [ %X, %cond_true.i ], [ %X2, %entry ] ; [#uses=1] + store i32 3, ptr %X + %tmp.3 = load i32, ptr %mem_tmp.i.0 ; [#uses=1] ret i32 %tmp.3 } diff --git a/llvm/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll b/llvm/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll index 8fac45dbf27a6..e8a7a5a1185c8 100644 --- a/llvm/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll +++ b/llvm/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll @@ -25,17 +25,17 @@ define i1 @lt_signed_to_large_unsigned(i8 %SB) { ; PR28011 - https://llvm.org/bugs/show_bug.cgi?id=28011 ; The above transform only applies to scalar integers; it shouldn't be attempted for constant expressions or vectors. -@a = common global i32** null +@a = common global ptr null @b = common global [1 x i32] zeroinitializer define i1 @PR28011(i16 %a) { ; CHECK-LABEL: @PR28011( ; CHECK-NEXT: [[CONV:%.*]] = sext i16 [[A:%.*]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[CONV]], or (i32 zext (i1 icmp ne (i32*** bitcast ([1 x i32]* @b to i32***), i32*** @a) to i32), i32 1) +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[CONV]], or (i32 zext (i1 icmp ne (ptr @b, ptr @a) to i32), i32 1) ; CHECK-NEXT: ret i1 [[CMP]] ; %conv = sext i16 %a to i32 - %cmp = icmp ne i32 %conv, or (i32 zext (i1 icmp ne (i32*** bitcast ([1 x i32]* @b to i32***), i32*** @a) to i32), i32 1) + %cmp = icmp ne i32 %conv, or (i32 zext (i1 icmp ne (ptr @b, ptr @a) to i32), i32 1) ret i1 %cmp } diff --git a/llvm/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll b/llvm/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll index 5ad06cddf4c07..ff43bd1914fa9 100644 --- a/llvm/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll +++ b/llvm/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll @@ -2,13 +2,13 @@ ; This example caused instcombine to spin into an infinite loop. -define void @test(i32* %P) { +define void @test(ptr %P) { ret void Dead: ; preds = %Dead %X = phi i32 [ %Y, %Dead ] ; [#uses=1] %Y = sdiv i32 %X, 10 ; [#uses=2] - store i32 %Y, i32* %P + store i32 %Y, ptr %P br label %Dead } diff --git a/llvm/test/Transforms/InstCombine/2006-09-15-CastToBool.ll b/llvm/test/Transforms/InstCombine/2006-09-15-CastToBool.ll index 7faaa8a85e991..3996d07296989 100644 --- a/llvm/test/Transforms/InstCombine/2006-09-15-CastToBool.ll +++ b/llvm/test/Transforms/InstCombine/2006-09-15-CastToBool.ll @@ -1,8 +1,8 @@ ; RUN: opt < %s -passes=instcombine -S | grep and ; PR913 -define i32 @test(i32* %tmp1) { - %tmp.i = load i32, i32* %tmp1 ; [#uses=1] +define i32 @test(ptr %tmp1) { + %tmp.i = load i32, ptr %tmp1 ; [#uses=1] %tmp = bitcast i32 %tmp.i to i32 ; [#uses=1] %tmp2.ui = lshr i32 %tmp, 5 ; [#uses=1] %tmp2 = bitcast i32 %tmp2.ui to i32 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll b/llvm/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll index 16b5940d34986..8ee737a995e7a 100644 --- a/llvm/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll +++ b/llvm/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll @@ -7,29 +7,23 @@ target triple = "i686-pc-linux-gnu" define i32 @visible(i32 %direction, i64 %p1.0, i64 %p2.0, i64 %p3.0) { entry: - %p1_addr = alloca %struct.point ; <%struct.point*> [#uses=2] - %p2_addr = alloca %struct.point ; <%struct.point*> [#uses=2] - %p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2] + %p1_addr = alloca %struct.point ; [#uses=2] + %p2_addr = alloca %struct.point ; [#uses=2] + %p3_addr = alloca %struct.point ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp.upgrd.1 = getelementptr { i64 }, { i64 }* %tmp, i64 0, i32 0 ; [#uses=1] - store i64 %p1.0, i64* %tmp.upgrd.1 - %tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp2 = getelementptr { i64 }, { i64 }* %tmp1, i64 0, i32 0 ; [#uses=1] - store i64 %p2.0, i64* %tmp2 - %tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp4 = getelementptr { i64 }, { i64 }* %tmp3, i64 0, i32 0 ; [#uses=1] - store i64 %p3.0, i64* %tmp4 + %tmp.upgrd.1 = getelementptr { i64 }, ptr %p1_addr, i64 0, i32 0 ; [#uses=1] + store i64 %p1.0, ptr %tmp.upgrd.1 + %tmp2 = getelementptr { i64 }, ptr %p2_addr, i64 0, i32 0 ; [#uses=1] + store i64 %p2.0, ptr %tmp2 + %tmp4 = getelementptr { i64 }, ptr %p3_addr, i64 0, i32 0 ; [#uses=1] + store i64 %p3.0, ptr %tmp4 %tmp.upgrd.2 = icmp eq i32 %direction, 0 ; [#uses=1] - %tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp6 = getelementptr { i64 }, { i64 }* %tmp5, i64 0, i32 0 ; [#uses=1] - %tmp.upgrd.3 = load i64, i64* %tmp6 ; [#uses=1] - %tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp8 = getelementptr { i64 }, { i64 }* %tmp7, i64 0, i32 0 ; [#uses=1] - %tmp9 = load i64, i64* %tmp8 ; [#uses=1] - %tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp11 = getelementptr { i64 }, { i64 }* %tmp10, i64 0, i32 0 ; [#uses=1] - %tmp12 = load i64, i64* %tmp11 ; [#uses=1] + %tmp6 = getelementptr { i64 }, ptr %p1_addr, i64 0, i32 0 ; [#uses=1] + %tmp.upgrd.3 = load i64, ptr %tmp6 ; [#uses=1] + %tmp8 = getelementptr { i64 }, ptr %p2_addr, i64 0, i32 0 ; [#uses=1] + %tmp9 = load i64, ptr %tmp8 ; [#uses=1] + %tmp11 = getelementptr { i64 }, ptr %p3_addr, i64 0, i32 0 ; [#uses=1] + %tmp12 = load i64, ptr %tmp11 ; [#uses=1] %tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; [#uses=2] br i1 %tmp.upgrd.2, label %cond_true, label %cond_false diff --git a/llvm/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll b/llvm/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll index 71b8e61967af5..392f7fc754239 100644 --- a/llvm/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll +++ b/llvm/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll @@ -8,28 +8,22 @@ target triple = "i686-pc-linux-gnu" define i32 @visible(i32 %direction, i64 %p1.0, i64 %p2.0, i64 %p3.0) { entry: - %p1_addr = alloca %struct.point ; <%struct.point*> [#uses=2] - %p2_addr = alloca %struct.point ; <%struct.point*> [#uses=2] - %p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2] - %tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp.upgrd.1 = getelementptr { i64 }, { i64 }* %tmp, i32 0, i32 0 ; [#uses=1] - store i64 %p1.0, i64* %tmp.upgrd.1 - %tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp2 = getelementptr { i64 }, { i64 }* %tmp1, i32 0, i32 0 ; [#uses=1] - store i64 %p2.0, i64* %tmp2 - %tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp4 = getelementptr { i64 }, { i64 }* %tmp3, i32 0, i32 0 ; [#uses=1] - store i64 %p3.0, i64* %tmp4 + %p1_addr = alloca %struct.point ; [#uses=2] + %p2_addr = alloca %struct.point ; [#uses=2] + %p3_addr = alloca %struct.point ; [#uses=2] + %tmp.upgrd.1 = getelementptr { i64 }, ptr %p1_addr, i32 0, i32 0 ; [#uses=1] + store i64 %p1.0, ptr %tmp.upgrd.1 + %tmp2 = getelementptr { i64 }, ptr %p2_addr, i32 0, i32 0 ; [#uses=1] + store i64 %p2.0, ptr %tmp2 + %tmp4 = getelementptr { i64 }, ptr %p3_addr, i32 0, i32 0 ; [#uses=1] + store i64 %p3.0, ptr %tmp4 %tmp.upgrd.2 = icmp eq i32 %direction, 0 ; [#uses=1] - %tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp6 = getelementptr { i64 }, { i64 }* %tmp5, i32 0, i32 0 ; [#uses=1] - %tmp.upgrd.3 = load i64, i64* %tmp6 ; [#uses=1] - %tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp8 = getelementptr { i64 }, { i64 }* %tmp7, i32 0, i32 0 ; [#uses=1] - %tmp9 = load i64, i64* %tmp8 ; [#uses=1] - %tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1] - %tmp11 = getelementptr { i64 }, { i64 }* %tmp10, i32 0, i32 0 ; [#uses=1] - %tmp12 = load i64, i64* %tmp11 ; [#uses=1] + %tmp6 = getelementptr { i64 }, ptr %p1_addr, i32 0, i32 0 ; [#uses=1] + %tmp.upgrd.3 = load i64, ptr %tmp6 ; [#uses=1] + %tmp8 = getelementptr { i64 }, ptr %p2_addr, i32 0, i32 0 ; [#uses=1] + %tmp9 = load i64, ptr %tmp8 ; [#uses=1] + %tmp11 = getelementptr { i64 }, ptr %p3_addr, i32 0, i32 0 ; [#uses=1] + %tmp12 = load i64, ptr %tmp11 ; [#uses=1] %tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; [#uses=2] %tmp14 = icmp slt i32 %tmp13, 0 ; [#uses=1] %tmp26 = icmp sgt i32 %tmp13, 0 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2006-12-15-Range-Test.ll b/llvm/test/Transforms/InstCombine/2006-12-15-Range-Test.ll index 0833d910f992c..1e64f90de6c66 100644 --- a/llvm/test/Transforms/InstCombine/2006-12-15-Range-Test.ll +++ b/llvm/test/Transforms/InstCombine/2006-12-15-Range-Test.ll @@ -3,21 +3,21 @@ target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" -@r = external global [17 x i32] ; <[17 x i32]*> [#uses=1] +@r = external global [17 x i32] ; [#uses=1] -define i1 @print_pgm_cond_true(i32 %tmp12.reload, i32* %tmp16.out) { +define i1 @print_pgm_cond_true(i32 %tmp12.reload, ptr %tmp16.out) { ; CHECK-LABEL: @print_pgm_cond_true( ; CHECK-NEXT: newFuncRoot: ; CHECK-NEXT: br label [[COND_TRUE:%.*]] ; CHECK: bb27.exitStub: -; CHECK-NEXT: store i32 [[TMP16:%.*]], i32* [[TMP16_OUT:%.*]], align 4 +; CHECK-NEXT: store i32 [[TMP16:%.*]], ptr [[TMP16_OUT:%.*]], align 4 ; CHECK-NEXT: ret i1 true ; CHECK: cond_next23.exitStub: -; CHECK-NEXT: store i32 [[TMP16]], i32* [[TMP16_OUT]], align 4 +; CHECK-NEXT: store i32 [[TMP16]], ptr [[TMP16_OUT]], align 4 ; CHECK-NEXT: ret i1 false ; CHECK: cond_true: -; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], [17 x i32]* @r, i32 0, i32 [[TMP12_RELOAD:%.*]] -; CHECK-NEXT: [[TMP16]] = load i32, i32* [[TMP15]], align 4 +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], ptr @r, i32 0, i32 [[TMP12_RELOAD:%.*]] +; CHECK-NEXT: [[TMP16]] = load i32, ptr [[TMP15]], align 4 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[TMP16]], -32 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP0]], -63 ; CHECK-NEXT: br i1 [[TMP1]], label [[BB27_EXITSTUB:%.*]], label [[COND_NEXT23_EXITSTUB:%.*]] @@ -26,35 +26,35 @@ newFuncRoot: br label %cond_true bb27.exitStub: ; preds = %cond_true - store i32 %tmp16, i32* %tmp16.out + store i32 %tmp16, ptr %tmp16.out ret i1 true cond_next23.exitStub: ; preds = %cond_true - store i32 %tmp16, i32* %tmp16.out + store i32 %tmp16, ptr %tmp16.out ret i1 false cond_true: ; preds = %newFuncRoot - %tmp15 = getelementptr [17 x i32], [17 x i32]* @r, i32 0, i32 %tmp12.reload ; [#uses=1] - %tmp16 = load i32, i32* %tmp15 ; [#uses=4] + %tmp15 = getelementptr [17 x i32], ptr @r, i32 0, i32 %tmp12.reload ; [#uses=1] + %tmp16 = load i32, ptr %tmp15 ; [#uses=4] %tmp18 = icmp slt i32 %tmp16, -31 ; [#uses=1] %tmp21 = icmp sgt i32 %tmp16, 31 ; [#uses=1] %bothcond = or i1 %tmp18, %tmp21 ; [#uses=1] br i1 %bothcond, label %bb27.exitStub, label %cond_next23.exitStub } -define i1 @print_pgm_cond_true_logical(i32 %tmp12.reload, i32* %tmp16.out) { +define i1 @print_pgm_cond_true_logical(i32 %tmp12.reload, ptr %tmp16.out) { ; CHECK-LABEL: @print_pgm_cond_true_logical( ; CHECK-NEXT: newFuncRoot: ; CHECK-NEXT: br label [[COND_TRUE:%.*]] ; CHECK: bb27.exitStub: -; CHECK-NEXT: store i32 [[TMP16:%.*]], i32* [[TMP16_OUT:%.*]], align 4 +; CHECK-NEXT: store i32 [[TMP16:%.*]], ptr [[TMP16_OUT:%.*]], align 4 ; CHECK-NEXT: ret i1 true ; CHECK: cond_next23.exitStub: -; CHECK-NEXT: store i32 [[TMP16]], i32* [[TMP16_OUT]], align 4 +; CHECK-NEXT: store i32 [[TMP16]], ptr [[TMP16_OUT]], align 4 ; CHECK-NEXT: ret i1 false ; CHECK: cond_true: -; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], [17 x i32]* @r, i32 0, i32 [[TMP12_RELOAD:%.*]] -; CHECK-NEXT: [[TMP16]] = load i32, i32* [[TMP15]], align 4 +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], ptr @r, i32 0, i32 [[TMP12_RELOAD:%.*]] +; CHECK-NEXT: [[TMP16]] = load i32, ptr [[TMP15]], align 4 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[TMP16]], -32 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP0]], -63 ; CHECK-NEXT: br i1 [[TMP1]], label [[BB27_EXITSTUB:%.*]], label [[COND_NEXT23_EXITSTUB:%.*]] @@ -63,16 +63,16 @@ newFuncRoot: br label %cond_true bb27.exitStub: ; preds = %cond_true - store i32 %tmp16, i32* %tmp16.out + store i32 %tmp16, ptr %tmp16.out ret i1 true cond_next23.exitStub: ; preds = %cond_true - store i32 %tmp16, i32* %tmp16.out + store i32 %tmp16, ptr %tmp16.out ret i1 false cond_true: ; preds = %newFuncRoot - %tmp15 = getelementptr [17 x i32], [17 x i32]* @r, i32 0, i32 %tmp12.reload ; [#uses=1] - %tmp16 = load i32, i32* %tmp15 ; [#uses=4] + %tmp15 = getelementptr [17 x i32], ptr @r, i32 0, i32 %tmp12.reload ; [#uses=1] + %tmp16 = load i32, ptr %tmp15 ; [#uses=4] %tmp18 = icmp slt i32 %tmp16, -31 ; [#uses=1] %tmp21 = icmp sgt i32 %tmp16, 31 ; [#uses=1] %bothcond = select i1 %tmp18, i1 true, i1 %tmp21 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll b/llvm/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll index 80e43cb0a89e4..07ff176f1593f 100644 --- a/llvm/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll +++ b/llvm/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll @@ -6,17 +6,17 @@ target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" %struct.internal_state = type { i32 } - %struct.mng_data = type { i32, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i8, double, double, double, i8, i8, i8, i8, i32, i32, i32, i32, i32, i8, i32, i32, i8*, i8* (i32)*, void (i8*, i32)*, void (i8*, i8*, i32)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*, i8*, i32, i32*)*, i8 (%struct.mng_data*, i8*, i32, i32*)*, i8 (%struct.mng_data*, i32, i8, i32, i32, i32, i32, i8*)*, i8 (%struct.mng_data*, i32, i32, i8*)*, i8 (%struct.mng_data*, i32, i32)*, i8 (%struct.mng_data*, i8, i8*, i8*, i8*, i8*)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*, i8*)*, i8 (%struct.mng_data*, i8*)*, i8 (%struct.mng_data*, i32, i32)*, i8 (%struct.mng_data*, i32, i32, i8*)*, i8 (%struct.mng_data*, i8, i8, i32, i32)*, i8* (%struct.mng_data*, i32)*, i8* (%struct.mng_data*, i32)*, i8* (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32, i32, i32, i32)*, i32 (%struct.mng_data*)*, i8 (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32, i32, i32, i32, i32, i32, i32, i32)*, i8 (%struct.mng_data*, i8)*, i8 (%struct.mng_data*, i32, i8*)*, i8 (%struct.mng_data*, i32, i8, i8*)*, i8, i32, i32, i8*, i8*, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, i8, i8, i8, i8, i32, i8, i8, i8, i32, i8*, i32, i8*, i32, i8, i8, i8, i32, i8*, i8*, i32, i32, i8*, i8*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, i8, i8, i32, i32, i8*, i8, i8, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i8*, i32, i32, i32, i8, i8, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i8*, i8*, i8*, i32, i8*, i8*, i8*, i8*, i8*, %struct.mng_savedata*, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, [256 x i8], double, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, i16, i8, i8, i8, i8, i8, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i16, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i32, i8, i32, i8, i16, i16, i16, i16, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i8*, i16, i16, i16, i8*, i8, i8, i32, i32, i32, i32, i8, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, i8*, i8, i8, i8, i32, i8*, i8*, i16, i16, i16, i16, i32, i32, i8*, %struct.z_stream, i32, i32, i32, i32, i32, i32, i8, i8, [256 x i32], i8 } + %struct.mng_data = type { i32, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i8, double, double, double, i8, i8, i8, i8, i32, i32, i32, i32, i32, i8, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, i8, i8, i8, i8, i32, i8, i8, i8, i32, ptr, i32, ptr, i32, i8, i8, i8, i32, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, ptr, i8, i8, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, ptr, i32, i32, i32, i8, i8, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, [256 x i8], double, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i16, i8, i8, i8, i8, i8, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i16, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i32, i8, i32, i8, i16, i16, i16, i16, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, ptr, i16, i16, i16, ptr, i8, i8, i32, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i32, ptr, ptr, i16, i16, i16, i16, i32, i32, ptr, %struct.z_stream, i32, i32, i32, i32, i32, i32, i8, i8, [256 x i32], i8 } %struct.mng_palette8e = type { i8, i8, i8 } - %struct.mng_pushdata = type { i8*, i8*, i32, i8, i8*, i32 } - %struct.mng_savedata = type { i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i8, i16, i8, i8, i32, i32, i8, i32, i32, i32, i32, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i8*, i16, i16, i16 } - %struct.z_stream = type { i8*, i32, i32, i8*, i32, i32, i8*, %struct.internal_state*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i8*, i32, i32, i32 } + %struct.mng_pushdata = type { ptr, ptr, i32, i8, ptr, i32 } + %struct.mng_savedata = type { i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i8, i16, i8, i8, i32, i32, i8, i32, i32, i32, i32, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, ptr, i16, i16, i16 } + %struct.z_stream = type { ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, i32 } -define void @mng_write_basi(i8* %src1, i16* %src2) { +define void @mng_write_basi(ptr %src1, ptr %src2) { entry: - %tmp = load i8, i8* %src1 ; [#uses=1] + %tmp = load i8, ptr %src1 ; [#uses=1] %tmp.upgrd.1 = icmp ugt i8 %tmp, 8 ; [#uses=1] - %tmp.upgrd.2 = load i16, i16* %src2; [#uses=2] + %tmp.upgrd.2 = load i16, ptr %src2; [#uses=2] %tmp3 = icmp eq i16 %tmp.upgrd.2, 255 ; [#uses=1] %tmp7 = icmp eq i16 %tmp.upgrd.2, -1 ; [#uses=1] %bOpaque.0.in = select i1 %tmp.upgrd.1, i1 %tmp7, i1 %tmp3 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll b/llvm/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll index 113ada3df9d93..242c21825aded 100644 --- a/llvm/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll +++ b/llvm/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll @@ -10,15 +10,15 @@ define i32 @test2(i32 %C) { entry: %A = alloca i32 %B = alloca i32 - %tmp = call i32 (...) @bar( i32* %A ) ; [#uses=0] - %T = load i32, i32* %A ; [#uses=1] + %tmp = call i32 (...) @bar( ptr %A ) ; [#uses=0] + %T = load i32, ptr %A ; [#uses=1] %tmp2 = icmp eq i32 %C, 0 ; [#uses=1] br i1 %tmp2, label %cond_next, label %cond_true cond_true: ; preds = %entry - store i32 123, i32* %B + store i32 123, ptr %B call i32 @test2( i32 123 ) ; :0 [#uses=0] - %T1 = load i32, i32* %B ; [#uses=1] + %T1 = load i32, ptr %B ; [#uses=1] br label %cond_next cond_next: ; preds = %cond_true, %entry diff --git a/llvm/test/Transforms/InstCombine/2007-02-07-PointerCast.ll b/llvm/test/Transforms/InstCombine/2007-02-07-PointerCast.ll index b7e2bc0de9507..cddd175d3225f 100644 --- a/llvm/test/Transforms/InstCombine/2007-02-07-PointerCast.ll +++ b/llvm/test/Transforms/InstCombine/2007-02-07-PointerCast.ll @@ -6,17 +6,17 @@ ; compile a kernel though... target datalayout = "e-p:32:32" -@str = internal constant [6 x i8] c"%llx\0A\00" ; <[6 x i8]*> [#uses=1] +@str = internal constant [6 x i8] c"%llx\0A\00" ; [#uses=1] -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) -define i32 @main(i32 %x, i8** %a) { +define i32 @main(i32 %x, ptr %a) { entry: - %tmp = getelementptr [6 x i8], [6 x i8]* @str, i32 0, i64 0 ; [#uses=1] - %tmp1 = load i8*, i8** %a ; [#uses=1] - %tmp2 = ptrtoint i8* %tmp1 to i32 ; [#uses=1] + %tmp = getelementptr [6 x i8], ptr @str, i32 0, i64 0 ; [#uses=1] + %tmp1 = load ptr, ptr %a ; [#uses=1] + %tmp2 = ptrtoint ptr %tmp1 to i32 ; [#uses=1] %tmp3 = zext i32 %tmp2 to i64 ; [#uses=1] - %tmp.upgrd.1 = call i32 (i8*, ...) @printf( i8* %tmp, i64 %tmp3 ) ; [#uses=0] + %tmp.upgrd.1 = call i32 (ptr, ...) @printf( ptr %tmp, i64 %tmp3 ) ; [#uses=0] ret i32 0 } diff --git a/llvm/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll b/llvm/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll index 45164f89c925b..2883fbe088216 100644 --- a/llvm/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll +++ b/llvm/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll @@ -3,12 +3,12 @@ target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" - %struct.termbox = type { %struct.termbox*, i32, i32, i32, i32, i32 } + %struct.termbox = type { ptr, i32, i32, i32, i32, i32 } define void @ggenorien() { entry: - %tmp68 = icmp eq %struct.termbox* null, null ; [#uses=1] + %tmp68 = icmp eq ptr null, null ; [#uses=1] br i1 %tmp68, label %cond_next448, label %bb80 bb80: ; preds = %entry diff --git a/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll b/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll index b3c00614f8fb5..2f0a49c4f5e6c 100644 --- a/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll +++ b/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll @@ -9,11 +9,9 @@ define i32 @main() { ; CHECK-LABEL: @main( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[U:%.*]] = alloca %struct..1anon, align 8 -; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds %struct..1anon, %struct..1anon* [[U]], i64 0, i32 0 -; CHECK-NEXT: store double 0x7FF0000000000000, double* [[TMP1]], align 8 -; CHECK-NEXT: [[TMP34:%.*]] = bitcast %struct..1anon* [[U]] to %struct..0anon* -; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds %struct..0anon, %struct..0anon* [[TMP34]], i64 0, i32 1 -; CHECK-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP5]], align 4 +; CHECK-NEXT: store double 0x7FF0000000000000, ptr [[U]], align 8 +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds %struct..0anon, ptr [[U]], i64 0, i32 1 +; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[TMP5]], align 4 ; CHECK-NEXT: [[TMP89:%.*]] = and i32 [[TMP6]], 2146435072 ; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i32 [[TMP89]], 2146435072 ; CHECK-NEXT: br i1 [[TMP0]], label %cond_false, label %cond_true @@ -24,12 +22,9 @@ define i32 @main() { ; entry: %u = alloca %struct..1anon, align 8 - %tmp1 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0 - store double 0x7FF0000000000000, double* %tmp1 - %tmp3 = getelementptr %struct..1anon, %struct..1anon* %u, i32 0, i32 0 - %tmp34 = bitcast double* %tmp3 to %struct..0anon* - %tmp5 = getelementptr %struct..0anon, %struct..0anon* %tmp34, i32 0, i32 1 - %tmp6 = load i32, i32* %tmp5 + store double 0x7FF0000000000000, ptr %u + %tmp5 = getelementptr %struct..0anon, ptr %u, i32 0, i32 1 + %tmp6 = load i32, ptr %tmp5 %tmp7 = shl i32 %tmp6, 1 %tmp8 = lshr i32 %tmp7, 21 %tmp89 = trunc i32 %tmp8 to i16 diff --git a/llvm/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll b/llvm/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll index 05d9c593eb23b..105d52dfec07e 100644 --- a/llvm/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll +++ b/llvm/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll @@ -6,8 +6,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i686-pc-linux-gnu" -define i1 @test(i32* %tmp141, i32* %tmp145, - i32 %b8, i32 %iftmp.430.0, i32* %tmp134.out, i32* %tmp137.out) +define i1 @test(ptr %tmp141, ptr %tmp145, + i32 %b8, i32 %iftmp.430.0, ptr %tmp134.out, ptr %tmp137.out) { newFuncRoot: %tmp133 = and i32 %b8, 1 ; [#uses=1] @@ -15,21 +15,21 @@ newFuncRoot: %tmp136 = ashr i32 %b8, 1 ; [#uses=1] %tmp137 = shl i32 %tmp136, 3 ; [#uses=3] %tmp139 = ashr i32 %tmp134, 2 ; [#uses=1] - store i32 %tmp139, i32* %tmp141 + store i32 %tmp139, ptr %tmp141 %tmp143 = ashr i32 %tmp137, 2 ; [#uses=1] - store i32 %tmp143, i32* %tmp145 + store i32 %tmp143, ptr %tmp145 icmp eq i32 %iftmp.430.0, 0 ; :0 [#uses=1] zext i1 %0 to i8 ; :1 [#uses=1] icmp ne i8 %1, 0 ; :2 [#uses=1] br i1 %2, label %cond_true147.exitStub, label %cond_false252.exitStub cond_true147.exitStub: ; preds = %newFuncRoot - store i32 %tmp134, i32* %tmp134.out - store i32 %tmp137, i32* %tmp137.out + store i32 %tmp134, ptr %tmp134.out + store i32 %tmp137, ptr %tmp137.out ret i1 true cond_false252.exitStub: ; preds = %newFuncRoot - store i32 %tmp134, i32* %tmp134.out - store i32 %tmp137, i32* %tmp137.out + store i32 %tmp134, ptr %tmp134.out + store i32 %tmp137, ptr %tmp137.out ret i1 false } diff --git a/llvm/test/Transforms/InstCombine/2007-05-14-Crash.ll b/llvm/test/Transforms/InstCombine/2007-05-14-Crash.ll index ecc8a28cba2f2..3610781357a90 100644 --- a/llvm/test/Transforms/InstCombine/2007-05-14-Crash.ll +++ b/llvm/test/Transforms/InstCombine/2007-05-14-Crash.ll @@ -4,15 +4,13 @@ target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "powerpc-unknown-linux-gnu" %struct.abc = type { i32, [32 x i8] } -%struct.def = type { i8**, %struct.abc } +%struct.def = type { ptr, %struct.abc } %struct.anon = type <{ }> -define i8* @foo(%struct.anon* %deviceRef, %struct.abc* %pCap) { +define ptr @foo(ptr %deviceRef, ptr %pCap) { entry: - %tmp1 = bitcast %struct.anon* %deviceRef to %struct.def* - %tmp3 = getelementptr %struct.def, %struct.def* %tmp1, i32 0, i32 1 - %tmp35 = bitcast %struct.abc* %tmp3 to i8* - ret i8* %tmp35 + %tmp3 = getelementptr %struct.def, ptr %deviceRef, i32 0, i32 1 + ret ptr %tmp3 } diff --git a/llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll index fbf363afce29a..868463ed141c7 100644 --- a/llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll +++ b/llvm/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll @@ -1,10 +1,10 @@ ; RUN: opt < %s -passes=instcombine -S | grep "call.*sret" ; Make sure instcombine doesn't drop the sret attribute. -define void @blah(i16* %tmp10) { +define void @blah(ptr %tmp10) { entry: - call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16*)*)(i16* sret(i16) %tmp10) + call void @objc_msgSend_stret(ptr sret(i16) %tmp10) ret void } -declare i8* @objc_msgSend_stret(i8*, i8*, ...) +declare ptr @objc_msgSend_stret(ptr, ptr, ...) diff --git a/llvm/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll b/llvm/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll index ed7b8769930a3..e0ab8350b6cb4 100644 --- a/llvm/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll +++ b/llvm/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -passes=instcombine -S | grep "ashr" ; PR1499 -define void @av_cmp_q_cond_true(i32* %retval, i32* %tmp9, i64* %tmp10) { +define void @av_cmp_q_cond_true(ptr %retval, ptr %tmp9, ptr %tmp10) { newFuncRoot: br label %cond_true @@ -9,14 +9,14 @@ return.exitStub: ; preds = %cond_true ret void cond_true: ; preds = %newFuncRoot - %tmp30 = load i64, i64* %tmp10 ; [#uses=1] + %tmp30 = load i64, ptr %tmp10 ; [#uses=1] %.cast = zext i32 63 to i64 ; [#uses=1] %tmp31 = ashr i64 %tmp30, %.cast ; [#uses=1] %tmp3132 = trunc i64 %tmp31 to i32 ; [#uses=1] %tmp33 = or i32 %tmp3132, 1 ; [#uses=1] - store i32 %tmp33, i32* %tmp9 - %tmp34 = load i32, i32* %tmp9 ; [#uses=1] - store i32 %tmp34, i32* %retval + store i32 %tmp33, ptr %tmp9 + %tmp34 = load i32, ptr %tmp9 ; [#uses=1] + store i32 %tmp34, ptr %retval br label %return.exitStub } diff --git a/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll b/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll index eb8cafc09eca8..be8e3eb860f33 100644 --- a/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll +++ b/llvm/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll @@ -1,15 +1,15 @@ ; RUN: opt < %s -passes=instcombine -S | grep icmp ; PR1646 -@__gthrw_pthread_cancel = weak alias i32 (i32), i32 (i32)* @pthread_cancel ; [#uses=1] -@__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) ; [#uses=1] +@__gthrw_pthread_cancel = weak alias i32 (i32), ptr @pthread_cancel ; [#uses=1] +@__gthread_active_ptr.5335 = internal constant ptr @__gthrw_pthread_cancel ; [#uses=1] define weak i32 @pthread_cancel(i32) { ret i32 0 } define i1 @__gthread_active_p() { entry: - %tmp1 = load i8*, i8** @__gthread_active_ptr.5335, align 4 ; [#uses=1] - %tmp2 = icmp ne i8* %tmp1, null ; [#uses=1] + %tmp1 = load ptr, ptr @__gthread_active_ptr.5335, align 4 ; [#uses=1] + %tmp2 = icmp ne ptr %tmp1, null ; [#uses=1] ret i1 %tmp2 } diff --git a/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll b/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll index ff1fd079457e1..c994d9aac811d 100644 --- a/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll +++ b/llvm/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -passes=instcombine -S | grep icmp ; PR1678 -@A = weak alias void (), void ()* @B ; [#uses=1] +@A = weak alias void (), ptr @B ; [#uses=1] define weak void @B() { ret void @@ -10,7 +10,7 @@ define weak void @B() { define i32 @active() { entry: %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp1 = icmp ne void ()* @A, null ; [#uses=1] + %tmp1 = icmp ne ptr @A, null ; [#uses=1] %tmp12 = zext i1 %tmp1 to i32 ; [#uses=1] ret i32 %tmp12 } diff --git a/llvm/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/llvm/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll index bb8ee3fa6aae8..bf178dd01592b 100644 --- a/llvm/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll +++ b/llvm/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll @@ -2,19 +2,18 @@ ; RUN: opt < %s -O3 -S | not grep xyz target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" -@.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1] +@.str = internal constant [4 x i8] c"xyz\00" ; [#uses=1] -define void @foo(i8* %P) { +define void @foo(ptr %P) { entry: - %P_addr = alloca i8* - store i8* %P, i8** %P_addr - %tmp = load i8*, i8** %P_addr, align 4 - %tmp1 = getelementptr [4 x i8], [4 x i8]* @.str, i32 0, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %tmp1, i32 4, i1 false) + %P_addr = alloca ptr + store ptr %P, ptr %P_addr + %tmp = load ptr, ptr %P_addr, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr %tmp, ptr @.str, i32 4, i1 false) br label %return return: ; preds = %entry ret void } -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind +declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind diff --git a/llvm/test/Transforms/InstCombine/2007-10-12-Crash.ll b/llvm/test/Transforms/InstCombine/2007-10-12-Crash.ll index c8d5a0c9024b6..4006de0f3b0c6 100644 --- a/llvm/test/Transforms/InstCombine/2007-10-12-Crash.ll +++ b/llvm/test/Transforms/InstCombine/2007-10-12-Crash.ll @@ -1,22 +1,21 @@ ; RUN: opt < %s -passes=instcombine -disable-output %struct.Ray = type { %struct.Vec, %struct.Vec } - %struct.Scene = type { i32 (...)** } + %struct.Scene = type { ptr } %struct.Vec = type { double, double, double } -declare double @_Z9ray_traceRK3VecRK3RayRK5Scene(%struct.Vec*, %struct.Ray*, %struct.Scene*) +declare double @_Z9ray_traceRK3VecRK3RayRK5Scene(ptr, ptr, ptr) -define i32 @main(i32 %argc, i8** %argv) { +define i32 @main(i32 %argc, ptr %argv) { entry: - %tmp3 = alloca %struct.Ray, align 4 ; <%struct.Ray*> [#uses=2] + %tmp3 = alloca %struct.Ray, align 4 ; [#uses=2] %tmp97 = icmp slt i32 0, 512 ; [#uses=1] br i1 %tmp97, label %bb71, label %bb108 bb29: ; preds = %bb62 - %tmp322 = bitcast %struct.Ray* %tmp3 to %struct.Vec* ; <%struct.Vec*> [#uses=1] - %tmp322.0 = getelementptr %struct.Vec, %struct.Vec* %tmp322, i32 0, i32 0 ; [#uses=1] - store double 0.000000e+00, double* %tmp322.0 - %tmp57 = call double @_Z9ray_traceRK3VecRK3RayRK5Scene( %struct.Vec* null, %struct.Ray* %tmp3, %struct.Scene* null ) ; [#uses=0] + %tmp322.0 = getelementptr %struct.Vec, ptr %tmp3, i32 0, i32 0 ; [#uses=1] + store double 0.000000e+00, ptr %tmp322.0 + %tmp57 = call double @_Z9ray_traceRK3VecRK3RayRK5Scene( ptr null, ptr %tmp3, ptr null ) ; [#uses=0] br label %bb62 bb62: ; preds = %bb71, %bb29 diff --git a/llvm/test/Transforms/InstCombine/2007-10-28-stacksave.ll b/llvm/test/Transforms/InstCombine/2007-10-28-stacksave.ll index f15568949a38d..a407cd2d3d3d1 100644 --- a/llvm/test/Transforms/InstCombine/2007-10-28-stacksave.ll +++ b/llvm/test/Transforms/InstCombine/2007-10-28-stacksave.ll @@ -2,7 +2,7 @@ ; PR1745 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" -@p = weak global i8* null ; [#uses=1] +@p = weak global ptr null ; [#uses=1] define i32 @main() { entry: @@ -11,7 +11,7 @@ entry: lab: ; preds = %cleanup31, %entry %n.0 = phi i32 [ 0, %entry ], [ %tmp25, %cleanup31 ] ; [#uses=2] - %tmp2 = call i8* @llvm.stacksave( ) ; [#uses=2] + %tmp2 = call ptr @llvm.stacksave( ) ; [#uses=2] %tmp4 = srem i32 %n.0, 47 ; [#uses=1] %tmp5 = add i32 %tmp4, 1 ; [#uses=5] %tmp7 = sub i32 %tmp5, 1 ; [#uses=0] @@ -21,12 +21,10 @@ lab: ; preds = %cleanup31, %entry %tmp1314 = zext i32 %tmp5 to i64 ; [#uses=1] %tmp15 = mul i64 %tmp1314, 32 ; [#uses=0] %tmp17 = mul i32 %tmp5, 4 ; [#uses=1] - %tmp18 = alloca i8, i32 %tmp17 ; [#uses=1] - %tmp1819 = bitcast i8* %tmp18 to i32* ; [#uses=2] - %tmp21 = getelementptr i32, i32* %tmp1819, i32 0 ; [#uses=1] - store i32 1, i32* %tmp21, align 4 - %tmp2223 = bitcast i32* %tmp1819 to i8* ; [#uses=1] - store volatile i8* %tmp2223, i8** @p, align 4 + %tmp18 = alloca i8, i32 %tmp17 ; [#uses=1] + %tmp21 = getelementptr i32, ptr %tmp18, i32 0 ; [#uses=1] + store i32 1, ptr %tmp21, align 4 + store volatile ptr %tmp18, ptr @p, align 4 %tmp25 = add i32 %n.0, 1 ; [#uses=2] %tmp27 = icmp sle i32 %tmp25, 999999 ; [#uses=1] %tmp2728 = zext i1 %tmp27 to i8 ; [#uses=1] @@ -34,14 +32,14 @@ lab: ; preds = %cleanup31, %entry br i1 %toBool, label %cleanup31, label %cond_next cond_next: ; preds = %lab - call void @llvm.stackrestore( i8* %tmp2 ) + call void @llvm.stackrestore( ptr %tmp2 ) ret i32 0 cleanup31: ; preds = %lab - call void @llvm.stackrestore( i8* %tmp2 ) + call void @llvm.stackrestore( ptr %tmp2 ) br label %lab } -declare i8* @llvm.stacksave() +declare ptr @llvm.stacksave() -declare void @llvm.stackrestore(i8*) +declare void @llvm.stackrestore(ptr) diff --git a/llvm/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll b/llvm/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll index 0fcd0a4bd68c7..2381d6a99e0e8 100644 --- a/llvm/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll +++ b/llvm/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll @@ -11,7 +11,7 @@ bb.i: ; preds = %entry br label %bb51.i.i bb27.i.i: ; preds = %bb51.i.i - %tmp31.i.i = load i16, i16* null, align 2 ; [#uses=2] + %tmp31.i.i = load i16, ptr null, align 2 ; [#uses=2] %tmp35.i.i = icmp ult i16 %tmp31.i.i, 1 ; [#uses=1] %tmp41.i.i = icmp ugt i16 %tmp31.i.i, -1 ; [#uses=1] %bothcond.i.i = or i1 %tmp35.i.i, %tmp41.i.i ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2007-10-31-StringCrash.ll b/llvm/test/Transforms/InstCombine/2007-10-31-StringCrash.ll index ba77c00e4a662..5a3ec386194ea 100644 --- a/llvm/test/Transforms/InstCombine/2007-10-31-StringCrash.ll +++ b/llvm/test/Transforms/InstCombine/2007-10-31-StringCrash.ll @@ -4,10 +4,9 @@ target triple = "i686-apple-darwin8" declare void @__darwin_gcc3_preregister_frame_info() -define void @_start(i32 %argc, i8** %argv, i8** %envp) { +define void @_start(i32 %argc, ptr %argv, ptr %envp) { entry: - %tmp1 = bitcast void ()* @__darwin_gcc3_preregister_frame_info to i32* ; [#uses=1] - %tmp2 = load i32, i32* %tmp1, align 4 ; [#uses=1] + %tmp2 = load i32, ptr @__darwin_gcc3_preregister_frame_info, align 4 ; [#uses=1] %tmp3 = icmp ne i32 %tmp2, 0 ; [#uses=1] %tmp34 = zext i1 %tmp3 to i8 ; [#uses=1] %toBool = icmp ne i8 %tmp34, 0 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/llvm/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll index 39111bff0e1ad..23547105c33d8 100644 --- a/llvm/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll +++ b/llvm/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll @@ -13,8 +13,8 @@ target triple = "i686-pc-linux-gnu" define i32 @foo() { entry: - %x = load i8, i8* bitcast (%opaque_t* @g to i8*) - %y = load i32, i32* bitcast (%op_ts* @h to i32*) + %x = load i8, ptr @g + %y = load i32, ptr @h %z = zext i8 %x to i32 %r = add i32 %y, %z ret i32 %r diff --git a/llvm/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/llvm/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll index 941e083969d43..9da8c6e6f96d9 100644 --- a/llvm/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll +++ b/llvm/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll @@ -1,12 +1,12 @@ ; RUN: opt < %s -passes=instcombine -S | not grep bitcast ; PR1716 -@.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] +@.str = internal constant [4 x i8] c"%d\0A\00" ; [#uses=1] -define i32 @main(i32 %argc, i8** %argv) { +define i32 @main(i32 %argc, ptr %argv) { entry: - %tmp32 = tail call i32 (i8* , ...) bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8], [4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; [#uses=0] + %tmp32 = tail call i32 (ptr , ...) @printf( ptr @.str , i32 0 ) nounwind ; [#uses=0] ret i32 undef } -declare i32 @printf(i8*, ...) nounwind +declare i32 @printf(ptr, ...) nounwind diff --git a/llvm/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll b/llvm/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll index 0af16714c920e..a6192a3f9df37 100644 --- a/llvm/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll +++ b/llvm/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll @@ -4,6 +4,6 @@ target triple = "i686-pc-linux-gnu" ; PR1850 define i1 @test() { - %cond = icmp ule i8* inttoptr (i64 4294967297 to i8*), inttoptr (i64 5 to i8*) + %cond = icmp ule ptr inttoptr (i64 4294967297 to ptr), inttoptr (i64 5 to ptr) ret i1 %cond } diff --git a/llvm/test/Transforms/InstCombine/2007-12-12-GEPScale.ll b/llvm/test/Transforms/InstCombine/2007-12-12-GEPScale.ll index 09fcfbd48468e..e8db5c0466403 100644 --- a/llvm/test/Transforms/InstCombine/2007-12-12-GEPScale.ll +++ b/llvm/test/Transforms/InstCombine/2007-12-12-GEPScale.ll @@ -2,9 +2,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" -define i8* @foo([100 x {i8,i8,i8}]* %x) { +define ptr @foo(ptr %x) { entry: - %p = bitcast [100 x {i8,i8,i8}]* %x to i8* - %q = getelementptr i8, i8* %p, i32 -4 - ret i8* %q + %q = getelementptr i8, ptr %x, i32 -4 + ret ptr %q } diff --git a/llvm/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll b/llvm/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll index 7260c001b0db6..1b46f33e40f30 100644 --- a/llvm/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll +++ b/llvm/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll @@ -3,8 +3,8 @@ define i32 @test1() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp ule i32 %sub, 0 %retval = select i1 %cmp, i32 0, i32 1 @@ -14,8 +14,8 @@ entry: define i32 @test2() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp ugt i32 %sub, 0 %retval = select i1 %cmp, i32 1, i32 0 @@ -25,8 +25,8 @@ entry: define i32 @test3() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp slt i32 %sub, 0 %retval = select i1 %cmp, i32 1, i32 0 @@ -36,8 +36,8 @@ entry: define i32 @test4() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp sle i32 %sub, 0 %retval = select i1 %cmp, i32 1, i32 0 @@ -47,8 +47,8 @@ entry: define i32 @test5() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp sge i32 %sub, 0 %retval = select i1 %cmp, i32 0, i32 1 @@ -58,8 +58,8 @@ entry: define i32 @test6() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp sgt i32 %sub, 0 %retval = select i1 %cmp, i32 0, i32 1 @@ -69,8 +69,8 @@ entry: define i32 @test7() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp eq i32 %sub, 0 %retval = select i1 %cmp, i32 0, i32 1 @@ -80,8 +80,8 @@ entry: define i32 @test8() { entry: %z = alloca i32 - store i32 0, i32* %z - %tmp = load i32, i32* %z + store i32 0, ptr %z + %tmp = load i32, ptr %z %sub = sub i32 %tmp, 1 %cmp = icmp ne i32 %sub, 0 %retval = select i1 %cmp, i32 1, i32 0 diff --git a/llvm/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/llvm/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll index 0bb9705295d47..462dfc73f2fe7 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll +++ b/llvm/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll @@ -7,7 +7,7 @@ define void @a() { ret void } -define signext i32 @b(i32* inreg %x) { +define signext i32 @b(ptr inreg %x) { ret i32 0 } @@ -15,16 +15,16 @@ define void @c(...) { ret void } -define void @g(i32* %y) { +define void @g(ptr %y) { ; CHECK-LABEL: @g( -; CHECK: call i64 bitcast (i32 (i32*)* @b to i64 (i32)*)(i32 0) - %x = call i64 bitcast (i32 (i32*)* @b to i64 (i32)*)( i32 0 ) ; [#uses=0] +; CHECK: call i64 @b(i32 0) + %x = call i64 @b( i32 0 ) ; [#uses=0] ; The rest should not have bitcasts remaining ; CHECK-NOT: bitcast - call void bitcast (void ()* @a to void (i32*)*)( i32* noalias %y ) - call <2 x i32> bitcast (i32 (i32*)* @b to <2 x i32> (i32*)*)( i32* inreg null ) ; <<2 x i32>>:1 [#uses=0] - call void bitcast (void (...)* @c to void (i32)*)( i32 0 ) - call void bitcast (void (...)* @c to void (i32)*)( i32 zeroext 0 ) + call void @a( ptr noalias %y ) + call <2 x i32> @b( ptr inreg null ) ; <<2 x i32>>:1 [#uses=0] + call void @c( i32 0 ) + call void @c( i32 zeroext 0 ) ret void } diff --git a/llvm/test/Transforms/InstCombine/2008-01-06-CastCrash.ll b/llvm/test/Transforms/InstCombine/2008-01-06-CastCrash.ll index 2cfd0a82d82fa..fe5e51bbbab95 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-06-CastCrash.ll +++ b/llvm/test/Transforms/InstCombine/2008-01-06-CastCrash.ll @@ -5,6 +5,6 @@ define <2 x i32> @f() { } define i32 @g() { - %x = call i32 bitcast (<2 x i32> ()* @f to i32 ()*)( ) ; [#uses=1] + %x = call i32 @f( ) ; [#uses=1] ret i32 %x } diff --git a/llvm/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll b/llvm/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll index e4fee58ca8f83..4f5ce4d00a100 100644 --- a/llvm/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll +++ b/llvm/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll @@ -1,26 +1,24 @@ ; RUN: opt < %s -passes=instcombine -S | grep zeroext - %struct.FRAME.nest = type { i32, i32 (...)* } + %struct.FRAME.nest = type { i32, ptr } %struct.__builtin_trampoline = type { [10 x i8] } -declare void @llvm.init.trampoline(i8*, i8*, i8*) nounwind -declare i8* @llvm.adjust.trampoline(i8*) nounwind +declare void @llvm.init.trampoline(ptr, ptr, ptr) nounwind +declare ptr @llvm.adjust.trampoline(ptr) nounwind -declare i32 @f(%struct.FRAME.nest* nest , ...) +declare i32 @f(ptr nest , ...) define i32 @nest(i32 %n) { entry: - %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3] - %TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1] - %TRAMP.216.sub = getelementptr [10 x i8], [10 x i8]* %TRAMP.216, i32 0, i32 0 ; [#uses=1] - %tmp3 = getelementptr %struct.FRAME.nest, %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; [#uses=1] - store i32 %n, i32* %tmp3, align 8 - %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; [#uses=1] - call void @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest*, ...)* @f to i8*), i8* %FRAME.06 ) ; [#uses=1] - %tramp = call i8* @llvm.adjust.trampoline( i8* %TRAMP.216.sub) - %tmp7 = getelementptr %struct.FRAME.nest, %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; [#uses=1] - %tmp89 = bitcast i8* %tramp to i32 (...)* ; [#uses=2] - store i32 (...)* %tmp89, i32 (...)** %tmp7, align 8 - %tmp2.i = call i32 (...) %tmp89( i32 zeroext 0 ) ; [#uses=1] + %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; [#uses=3] + %TRAMP.216 = alloca [10 x i8], align 16 ; [#uses=1] + %TRAMP.216.sub = getelementptr [10 x i8], ptr %TRAMP.216, i32 0, i32 0 ; [#uses=1] + %tmp3 = getelementptr %struct.FRAME.nest, ptr %FRAME.0, i32 0, i32 0 ; [#uses=1] + store i32 %n, ptr %tmp3, align 8 + call void @llvm.init.trampoline( ptr %TRAMP.216.sub, ptr @f, ptr %FRAME.0 ) ; [#uses=1] + %tramp = call ptr @llvm.adjust.trampoline( ptr %TRAMP.216.sub) + %tmp7 = getelementptr %struct.FRAME.nest, ptr %FRAME.0, i32 0, i32 1 ; [#uses=1] + store ptr %tramp, ptr %tmp7, align 8 + %tmp2.i = call i32 (...) %tramp( i32 zeroext 0 ) ; [#uses=1] ret i32 %tmp2.i } diff --git a/llvm/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll b/llvm/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll index 3c5e6608648c5..26806159a3a45 100644 --- a/llvm/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll +++ b/llvm/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -passes=instcombine -S | grep "16" | count 1 -define i8* @bork(i8** %qux) { - %tmp275 = load i8*, i8** %qux, align 1 - %tmp275276 = ptrtoint i8* %tmp275 to i32 +define ptr @bork(ptr %qux) { + %tmp275 = load ptr, ptr %qux, align 1 + %tmp275276 = ptrtoint ptr %tmp275 to i32 %tmp277 = add i32 %tmp275276, 16 - %tmp277278 = inttoptr i32 %tmp277 to i8* - ret i8* %tmp277278 + %tmp277278 = inttoptr i32 %tmp277 to ptr + ret ptr %tmp277278 } diff --git a/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll b/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll index 62a9d83255663..2dcf902dc34f5 100644 --- a/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll +++ b/llvm/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll @@ -1,8 +1,8 @@ ; RUN: opt < %s -passes=instcombine -S | grep "store volatile" define void @test() { - %votf = alloca <4 x float> ; <<4 x float>*> [#uses=1] - store volatile <4 x float> zeroinitializer, <4 x float>* %votf, align 16 + %votf = alloca <4 x float> ; [#uses=1] + store volatile <4 x float> zeroinitializer, ptr %votf, align 16 ret void } diff --git a/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll b/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll index a797ed4902b04..43dda98a1791f 100644 --- a/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll +++ b/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll @@ -1,22 +1,22 @@ ; RUN: opt < %s -passes=instcombine -S | grep "load volatile" | count 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" -@g_1 = internal global i32 0 ; [#uses=3] +@g_1 = internal global i32 0 ; [#uses=3] define i32 @main() nounwind { entry: %tmp93 = icmp slt i32 0, 10 ; [#uses=0] - %tmp34 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp34 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br label %bb bb: ; preds = %bb, %entry %b.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb ] ; [#uses=1] %tmp3.reg2mem.0 = phi i32 [ %tmp34, %entry ], [ %tmp3, %bb ] ; [#uses=1] %tmp4 = add i32 %tmp3.reg2mem.0, 5 ; [#uses=1] - store volatile i32 %tmp4, i32* @g_1, align 4 + store volatile i32 %tmp4, ptr @g_1, align 4 %tmp6 = add i32 %b.0.reg2mem.0, 1 ; [#uses=2] %tmp9 = icmp slt i32 %tmp6, 10 ; [#uses=1] - %tmp3 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp3 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br i1 %tmp9, label %bb, label %bb11 bb11: ; preds = %bb diff --git a/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll b/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll index 53974badba7b1..72e27139e775f 100644 --- a/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll +++ b/llvm/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll @@ -2,16 +2,16 @@ ; PR2262 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" -@g_1 = internal global i32 0 ; [#uses=3] +@g_1 = internal global i32 0 ; [#uses=3] define i32 @main(i32 %i) nounwind { entry: %tmp93 = icmp slt i32 %i, 10 ; [#uses=0] - %tmp34 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp34 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br i1 %tmp93, label %bb11, label %bb bb: ; preds = %bb, %entry - %tmp3 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp3 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br label %bb11 bb11: ; preds = %bb diff --git a/llvm/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll b/llvm/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll index 4be97d8ff44cd..8c3c8cf0919a9 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll @@ -6,20 +6,20 @@ target triple = "i386-apple-darwin8" define i32 @a() nounwind { entry: %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp1 = call i8* @malloc( i32 10 ) nounwind ; [#uses=5] - %tmp3 = getelementptr i8, i8* %tmp1, i32 1 ; [#uses=1] - store i8 0, i8* %tmp3, align 1 - %tmp5 = getelementptr i8, i8* %tmp1, i32 0 ; [#uses=1] - store i8 1, i8* %tmp5, align 1 - %tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; [#uses=1] - %tmp9 = getelementptr i8, i8* %tmp1, i32 0 ; [#uses=1] - store i8 0, i8* %tmp9, align 1 - %tmp11 = call i32 (...) @b( i8* %tmp1 ) nounwind ; [#uses=0] + %tmp1 = call ptr @malloc( i32 10 ) nounwind ; [#uses=5] + %tmp3 = getelementptr i8, ptr %tmp1, i32 1 ; [#uses=1] + store i8 0, ptr %tmp3, align 1 + %tmp5 = getelementptr i8, ptr %tmp1, i32 0 ; [#uses=1] + store i8 1, ptr %tmp5, align 1 + %tmp7 = call i32 @strlen( ptr %tmp1 ) nounwind readonly ; [#uses=1] + %tmp9 = getelementptr i8, ptr %tmp1, i32 0 ; [#uses=1] + store i8 0, ptr %tmp9, align 1 + %tmp11 = call i32 (...) @b( ptr %tmp1 ) nounwind ; [#uses=0] ret i32 %tmp7 } -declare i8* @malloc(i32) nounwind +declare ptr @malloc(i32) nounwind -declare i32 @strlen(i8*) nounwind readonly +declare i32 @strlen(ptr) nounwind readonly declare i32 @b(...) diff --git a/llvm/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll b/llvm/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll index 03c9590ec51c9..50c0f7ccee6fd 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll @@ -6,27 +6,27 @@ target triple = "i386-apple-darwin8" define i32 @a() nounwind { entry: %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp1 = call i8* @malloc( i32 10 ) nounwind ; [#uses=5] - %tmp3 = getelementptr i8, i8* %tmp1, i32 1 ; [#uses=1] - store i8 0, i8* %tmp3, align 1 - %tmp5 = getelementptr i8, i8* %tmp1, i32 0 ; [#uses=1] - store i8 1, i8* %tmp5, align 1 + %tmp1 = call ptr @malloc( i32 10 ) nounwind ; [#uses=5] + %tmp3 = getelementptr i8, ptr %tmp1, i32 1 ; [#uses=1] + store i8 0, ptr %tmp3, align 1 + %tmp5 = getelementptr i8, ptr %tmp1, i32 0 ; [#uses=1] + store i8 1, ptr %tmp5, align 1 ; CHECK: store ; CHECK: store ; CHECK-NEXT: strlen ; CHECK-NEXT: store - %tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; [#uses=1] - %tmp9 = getelementptr i8, i8* %tmp1, i32 0 ; [#uses=1] - store i8 0, i8* %tmp9, align 1 - %tmp11 = call i32 (...) @b( i8* %tmp1 ) nounwind ; [#uses=0] + %tmp7 = call i32 @strlen( ptr %tmp1 ) nounwind readonly ; [#uses=1] + %tmp9 = getelementptr i8, ptr %tmp1, i32 0 ; [#uses=1] + store i8 0, ptr %tmp9, align 1 + %tmp11 = call i32 (...) @b( ptr %tmp1 ) nounwind ; [#uses=0] br label %return return: ; preds = %entry ret i32 %tmp7 } -declare i8* @malloc(i32) nounwind +declare ptr @malloc(i32) nounwind -declare i32 @strlen(i8*) nounwind readonly +declare i32 @strlen(ptr) nounwind readonly declare i32 @b(...) diff --git a/llvm/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll b/llvm/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll index b5f38db536d03..c7909539841d7 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll @@ -1,35 +1,35 @@ ; RUN: opt < %s -passes=instcombine -disable-output ; PR2303 - %"struct.std::ctype" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 } - %"struct.std::locale::facet" = type { i32 (...)**, i32 } + %"struct.std::ctype" = type { %"struct.std::locale::facet", ptr, i8, ptr, ptr, ptr, i8, [256 x i8], [256 x i8], i8 } + %"struct.std::locale::facet" = type { ptr, i32 } -declare i32* @_ZNSt6locale5facet15_S_get_c_localeEv() +declare ptr @_ZNSt6locale5facet15_S_get_c_localeEv() -declare i32** @__ctype_toupper_loc() readnone +declare ptr @__ctype_toupper_loc() readnone -declare i32** @__ctype_tolower_loc() readnone +declare ptr @__ctype_tolower_loc() readnone -define void @_ZNSt5ctypeIcEC2EPiPKtbm(%"struct.std::ctype"* %this, i32* %unnamed_arg, i16* %__table, i8 zeroext %__del, i64 %__refs) personality i32 (...)* @__gxx_personality_v0 { +define void @_ZNSt5ctypeIcEC2EPiPKtbm(ptr %this, ptr %unnamed_arg, ptr %__table, i8 zeroext %__del, i64 %__refs) personality ptr @__gxx_personality_v0 { entry: - %tmp8 = invoke i32* @_ZNSt6locale5facet15_S_get_c_localeEv( ) - to label %invcont unwind label %lpad ; [#uses=0] + %tmp8 = invoke ptr @_ZNSt6locale5facet15_S_get_c_localeEv( ) + to label %invcont unwind label %lpad ; [#uses=0] invcont: ; preds = %entry - %tmp32 = invoke i32** @__ctype_toupper_loc( ) readnone - to label %invcont31 unwind label %lpad ; [#uses=0] + %tmp32 = invoke ptr @__ctype_toupper_loc( ) readnone + to label %invcont31 unwind label %lpad ; [#uses=0] invcont31: ; preds = %invcont - %tmp38 = invoke i32** @__ctype_tolower_loc( ) readnone - to label %invcont37 unwind label %lpad ; [#uses=1] + %tmp38 = invoke ptr @__ctype_tolower_loc( ) readnone + to label %invcont37 unwind label %lpad ; [#uses=1] invcont37: ; preds = %invcont31 - %tmp39 = load i32*, i32** %tmp38, align 8 ; [#uses=1] - %tmp41 = getelementptr %"struct.std::ctype", %"struct.std::ctype"* %this, i32 0, i32 4 ; [#uses=1] - store i32* %tmp39, i32** %tmp41, align 8 + %tmp39 = load ptr, ptr %tmp38, align 8 ; [#uses=1] + %tmp41 = getelementptr %"struct.std::ctype", ptr %this, i32 0, i32 4 ; [#uses=1] + store ptr %tmp39, ptr %tmp41, align 8 ret void lpad: ; preds = %invcont31, %invcont, %entry - %exn = landingpad {i8*, i32} + %exn = landingpad {ptr, i32} cleanup unreachable } diff --git a/llvm/test/Transforms/InstCombine/2008-05-17-InfLoop.ll b/llvm/test/Transforms/InstCombine/2008-05-17-InfLoop.ll index ac23fa3fc8522..1358f5e521eaa 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-17-InfLoop.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-17-InfLoop.ll @@ -7,14 +7,14 @@ declare void @BZALLOC(i32) define void @f(i32) { entry: - %blockSize100k = alloca i32 ; [#uses=2] - store i32 %0, i32* %blockSize100k - %n = alloca i32 ; [#uses=2] - load i32, i32* %blockSize100k ; :1 [#uses=1] - store i32 %1, i32* %n - load i32, i32* %n ; :2 [#uses=1] + %blockSize100k = alloca i32 ; [#uses=2] + store i32 %0, ptr %blockSize100k + %n = alloca i32 ; [#uses=2] + load i32, ptr %blockSize100k ; :1 [#uses=1] + store i32 %1, ptr %n + load i32, ptr %n ; :2 [#uses=1] add i32 %2, 2 ; :3 [#uses=1] - mul i32 %3, ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i32) ; :4 [#uses=1] + mul i32 %3, ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i32) ; :4 [#uses=1] call void @BZALLOC( i32 %4 ) br label %return diff --git a/llvm/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll b/llvm/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll index 9b34dd1d751ff..5b7bbefb77e05 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll @@ -5,9 +5,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i386-pc-linux-gnu" define i1 @f1() { - ret i1 icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*)) + ret i1 icmp eq (ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 2 to ptr)) } define i1 @f2() { - ret i1 icmp eq (i8* inttoptr (i16 1 to i8*), i8* inttoptr (i16 2 to i8*)) + ret i1 icmp eq (ptr inttoptr (i16 1 to ptr), ptr inttoptr (i16 2 to ptr)) } diff --git a/llvm/test/Transforms/InstCombine/2008-05-23-CompareFold.ll b/llvm/test/Transforms/InstCombine/2008-05-23-CompareFold.ll index 81db043eca818..66751eb704548 100644 --- a/llvm/test/Transforms/InstCombine/2008-05-23-CompareFold.ll +++ b/llvm/test/Transforms/InstCombine/2008-05-23-CompareFold.ll @@ -3,9 +3,9 @@ ; CHECK-LABEL: @f( ; CHECK: ret i1 false -define i1 @f(i8* %x) { +define i1 @f(ptr %x) { entry: - %tmp462 = load i8, i8* %x, align 1 ; [#uses=1] + %tmp462 = load i8, ptr %x, align 1 ; [#uses=1] %tmp462463 = sitofp i8 %tmp462 to float ; [#uses=1] %tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000 ; ret i1 %tmp464 diff --git a/llvm/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll b/llvm/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll index 1932152fbf825..46270f7f72c15 100644 --- a/llvm/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll +++ b/llvm/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll @@ -1,17 +1,17 @@ ; RUN: opt < %s -passes=instcombine -S | grep "store i32" | count 2 -@g_139 = global i32 0 ; [#uses=2] +@g_139 = global i32 0 ; [#uses=2] define void @func_56(i32 %p_60) nounwind { entry: - store i32 1, i32* @g_139, align 4 + store i32 1, ptr @g_139, align 4 %tmp1 = icmp ne i32 %p_60, 0 ; [#uses=1] %tmp12 = zext i1 %tmp1 to i8 ; [#uses=1] %toBool = icmp ne i8 %tmp12, 0 ; [#uses=1] br i1 %toBool, label %bb, label %return bb: ; preds = %bb, %entry - store i32 1, i32* @g_139, align 4 + store i32 1, ptr @g_139, align 4 br label %bb return: ; preds = %entry diff --git a/llvm/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll b/llvm/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll index 377d223296239..2cb5c974853f9 100644 --- a/llvm/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll +++ b/llvm/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll @@ -1,19 +1,19 @@ ; RUN: opt < %s -passes=instcombine -S | grep "store i8" | count 2 -define i32 @a(i8* %s) nounwind { +define i32 @a(ptr %s) nounwind { entry: - store i8 0, i8* %s, align 1 ; This store cannot be eliminated! - %tmp3 = call i32 @strlen( i8* %s ) nounwind readonly + store i8 0, ptr %s, align 1 ; This store cannot be eliminated! + %tmp3 = call i32 @strlen( ptr %s ) nounwind readonly %tmp5 = icmp ne i32 %tmp3, 0 br i1 %tmp5, label %bb, label %bb8 bb: ; preds = %entry - store i8 0, i8* %s, align 1 + store i8 0, ptr %s, align 1 br label %bb8 bb8: ret i32 %tmp3 } -declare i32 @strlen(i8*) nounwind readonly +declare i32 @strlen(ptr) nounwind readonly diff --git a/llvm/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll b/llvm/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll index 59d0ded685958..e03371d00f6a3 100644 --- a/llvm/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll +++ b/llvm/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll @@ -1,16 +1,16 @@ ; RUN: opt < %s -passes=instcombine -S | grep load | count 3 ; PR2471 -declare i32 @x(i32*) -define i32 @b(i32* %a, i32* %b) { +declare i32 @x(ptr) +define i32 @b(ptr %a, ptr %b) { entry: - %tmp1 = load i32, i32* %a - %tmp3 = load i32, i32* %b + %tmp1 = load i32, ptr %a + %tmp3 = load i32, ptr %b %add = add i32 %tmp1, %tmp3 - %call = call i32 @x( i32* %a ) + %call = call i32 @x( ptr %a ) %tobool = icmp ne i32 %add, 0 ; not safe to turn into an uncond load - %cond = select i1 %tobool, i32* %b, i32* %a - %tmp8 = load i32, i32* %cond + %cond = select i1 %tobool, ptr %b, ptr %a + %tmp8 = load i32, ptr %cond ret i32 %tmp8 } diff --git a/llvm/test/Transforms/InstCombine/2008-06-24-StackRestore.ll b/llvm/test/Transforms/InstCombine/2008-06-24-StackRestore.ll index cb06571f41490..a88570e536254 100644 --- a/llvm/test/Transforms/InstCombine/2008-06-24-StackRestore.ll +++ b/llvm/test/Transforms/InstCombine/2008-06-24-StackRestore.ll @@ -2,15 +2,14 @@ ; PR2488 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" -@p = weak global i8* null ; [#uses=2] +@p = weak global ptr null ; [#uses=2] define i32 @main() nounwind { entry: - %tmp248 = call i8* @llvm.stacksave( ) ; [#uses=1] - %tmp2752 = alloca i32 ; [#uses=2] - %tmpcast53 = bitcast i32* %tmp2752 to i8* ; [#uses=1] - store i32 2, i32* %tmp2752, align 4 - store volatile i8* %tmpcast53, i8** @p, align 4 + %tmp248 = call ptr @llvm.stacksave( ) ; [#uses=1] + %tmp2752 = alloca i32 ; [#uses=2] + store i32 2, ptr %tmp2752, align 4 + store volatile ptr %tmp2752, ptr @p, align 4 br label %bb44 bb: ; preds = %bb44 @@ -18,22 +17,21 @@ bb: ; preds = %bb44 bb44: ; preds = %bb44, %entry %indvar = phi i32 [ 0, %entry ], [ %tmp3857, %bb44 ] ; [#uses=1] - %tmp249 = phi i8* [ %tmp248, %entry ], [ %tmp2, %bb44 ] ; [#uses=1] + %tmp249 = phi ptr [ %tmp248, %entry ], [ %tmp2, %bb44 ] ; [#uses=1] %tmp3857 = add i32 %indvar, 1 ; [#uses=3] - call void @llvm.stackrestore( i8* %tmp249 ) - %tmp2 = call i8* @llvm.stacksave( ) ; [#uses=1] + call void @llvm.stackrestore( ptr %tmp249 ) + %tmp2 = call ptr @llvm.stacksave( ) ; [#uses=1] %tmp4 = srem i32 %tmp3857, 1000 ; [#uses=2] %tmp5 = add i32 %tmp4, 1 ; [#uses=1] - %tmp27 = alloca i32, i32 %tmp5 ; [#uses=3] - %tmpcast = bitcast i32* %tmp27 to i8* ; [#uses=1] - store i32 1, i32* %tmp27, align 4 - %tmp34 = getelementptr i32, i32* %tmp27, i32 %tmp4 ; [#uses=1] - store i32 2, i32* %tmp34, align 4 - store volatile i8* %tmpcast, i8** @p, align 4 + %tmp27 = alloca i32, i32 %tmp5 ; [#uses=3] + store i32 1, ptr %tmp27, align 4 + %tmp34 = getelementptr i32, ptr %tmp27, i32 %tmp4 ; [#uses=1] + store i32 2, ptr %tmp34, align 4 + store volatile ptr %tmp27, ptr @p, align 4 %exitcond = icmp eq i32 %tmp3857, 999999 ; [#uses=1] br i1 %exitcond, label %bb, label %bb44 } -declare i8* @llvm.stacksave() nounwind +declare ptr @llvm.stacksave() nounwind -declare void @llvm.stackrestore(i8*) nounwind +declare void @llvm.stackrestore(ptr) nounwind diff --git a/llvm/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll b/llvm/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll index 5ea323a7f11a1..f45b0a1bb9853 100644 --- a/llvm/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll +++ b/llvm/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll @@ -2,22 +2,22 @@ ; PR2496 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" -@g_1 = internal global i32 0 ; [#uses=3] +@g_1 = internal global i32 0 ; [#uses=3] define i32 @main() nounwind { entry: %tmp93 = icmp slt i32 0, 10 ; [#uses=0] - %tmp34 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp34 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br label %bb bb: ; preds = %bb, %entry %b.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb ] ; [#uses=1] %tmp3.reg2mem.0 = phi i32 [ %tmp3, %bb ], [ %tmp34, %entry ] %tmp4 = add i32 %tmp3.reg2mem.0, 5 ; [#uses=1] - store volatile i32 %tmp4, i32* @g_1, align 4 + store volatile i32 %tmp4, ptr @g_1, align 4 %tmp6 = add i32 %b.0.reg2mem.0, 1 ; [#uses=2] %tmp9 = icmp slt i32 %tmp6, 10 ; [#uses=1] - %tmp3 = load volatile i32, i32* @g_1, align 4 ; [#uses=1] + %tmp3 = load volatile i32, ptr @g_1, align 4 ; [#uses=1] br i1 %tmp9, label %bb, label %bb11 bb11: ; preds = %bb diff --git a/llvm/test/Transforms/InstCombine/2008-08-05-And.ll b/llvm/test/Transforms/InstCombine/2008-08-05-And.ll index 8aa86a5cb9b45..1ab49007eedf4 100644 --- a/llvm/test/Transforms/InstCombine/2008-08-05-And.ll +++ b/llvm/test/Transforms/InstCombine/2008-08-05-And.ll @@ -2,12 +2,12 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; PR2629 -define void @f(i8* %x) nounwind { +define void @f(ptr %x) nounwind { ; CHECK-LABEL: @f( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: -; CHECK-NEXT: [[L1:%.*]] = load i8, i8* [[X:%.*]], align 1 +; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[X:%.*]], align 1 ; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[L1]], -9 ; CHECK-NEXT: [[C1:%.*]] = icmp ult i8 [[TMP0]], -3 ; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[L1]], -13 @@ -23,8 +23,7 @@ entry: br label %bb bb: - %g1 = getelementptr i8, i8* %x, i32 0 - %l1 = load i8, i8* %g1, align 1 + %l1 = load i8, ptr %x, align 1 %s1 = sub i8 %l1, 6 %c1 = icmp ugt i8 %s1, 2 %s2 = sub i8 %l1, 10 @@ -39,12 +38,12 @@ incompatible: ret void } -define void @f_logical(i8* %x) nounwind { +define void @f_logical(ptr %x) nounwind { ; CHECK-LABEL: @f_logical( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB:%.*]] ; CHECK: bb: -; CHECK-NEXT: [[L1:%.*]] = load i8, i8* [[X:%.*]], align 1 +; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[X:%.*]], align 1 ; CHECK-NEXT: [[TMP0:%.*]] = add i8 [[L1]], -9 ; CHECK-NEXT: [[C1:%.*]] = icmp ult i8 [[TMP0]], -3 ; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[L1]], -13 @@ -60,8 +59,7 @@ entry: br label %bb bb: - %g1 = getelementptr i8, i8* %x, i32 0 - %l1 = load i8, i8* %g1, align 1 + %l1 = load i8, ptr %x, align 1 %s1 = sub i8 %l1, 6 %c1 = icmp ugt i8 %s1, 2 %s2 = sub i8 %l1, 10 diff --git a/llvm/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll b/llvm/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll index 346c97ee446b5..f86a1bbca130e 100644 --- a/llvm/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll +++ b/llvm/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll @@ -22,6 +22,6 @@ define void @entry(i32 %m_task_id, i32 %start_x, i32 %end_x, i32 %start_y, i32 % %11 = extractelement <2 x i32> %10, i32 1 ; [#uses=1] %12 = insertelement <4 x i32> zeroinitializer, i32 %11, i32 3 ; <<4 x i32>> [#uses=1] %13 = sitofp <4 x i32> %12 to <4 x float> ; <<4 x float>> [#uses=1] - store <4 x float> %13, <4 x float>* null + store <4 x float> %13, ptr null br label %4 } diff --git a/llvm/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll b/llvm/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll index fda6cb07f6b03..a01da8267f144 100644 --- a/llvm/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll +++ b/llvm/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll @@ -2,7 +2,7 @@ ; PR2940 define i32 @tstid() { - %var0 = inttoptr i32 1 to i8* ; [#uses=1] - %var2 = ptrtoint i8* %var0 to i32 ; [#uses=1] + %var0 = inttoptr i32 1 to ptr ; [#uses=1] + %var2 = ptrtoint ptr %var0 to i32 ; [#uses=1] ret i32 %var2 } diff --git a/llvm/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll b/llvm/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll index 0f3e3ac1027d4..df389eaaec4c2 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll @@ -3,9 +3,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" -define i32 @test(i32* %P) nounwind { +define i32 @test(ptr %P) nounwind { entry: - %Q = addrspacecast i32* %P to i32 addrspace(1)* - store i32 0, i32 addrspace(1)* %Q, align 4 + %Q = addrspacecast ptr %P to ptr addrspace(1) + store i32 0, ptr addrspace(1) %Q, align 4 ret i32 0 } diff --git a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll index 660cba57f5e7b..d1e8972548653 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll @@ -6,42 +6,42 @@ ; ModuleID = 'apf.c' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" -@"\01LC" = internal constant [4 x i8] c"%f\0A\00" ; <[4 x i8]*> [#uses=1] +@"\01LC" = internal constant [4 x i8] c"%f\0A\00" ; [#uses=1] define void @foo1() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF0000000000000, float* %x, align 4 - store float 0x7FF8000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF0000000000000, ptr %x, align 4 + store float 0x7FF8000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry ret void } -declare i32 @printf(i8*, ...) nounwind +declare i32 @printf(ptr, ...) nounwind define void @foo2() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF0000000000000, float* %x, align 4 - store float 0.000000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF0000000000000, ptr %x, align 4 + store float 0.000000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -50,17 +50,17 @@ return: ; preds = %entry define void @foo3() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF0000000000000, float* %x, align 4 - store float 3.500000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF0000000000000, ptr %x, align 4 + store float 3.500000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -69,17 +69,17 @@ return: ; preds = %entry define void @foo4() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF0000000000000, float* %x, align 4 - store float 0x7FF0000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF0000000000000, ptr %x, align 4 + store float 0x7FF0000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -88,17 +88,17 @@ return: ; preds = %entry define void @foo5() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF8000000000000, float* %x, align 4 - store float 0x7FF0000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF8000000000000, ptr %x, align 4 + store float 0x7FF0000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -107,17 +107,17 @@ return: ; preds = %entry define void @foo6() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF8000000000000, float* %x, align 4 - store float 0.000000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF8000000000000, ptr %x, align 4 + store float 0.000000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -126,17 +126,17 @@ return: ; preds = %entry define void @foo7() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF8000000000000, float* %x, align 4 - store float 3.500000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF8000000000000, ptr %x, align 4 + store float 3.500000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -145,17 +145,17 @@ return: ; preds = %entry define void @foo8() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0x7FF8000000000000, float* %x, align 4 - store float 0x7FF8000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0x7FF8000000000000, ptr %x, align 4 + store float 0x7FF8000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -164,17 +164,17 @@ return: ; preds = %entry define void @foo9() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0.000000e+00, float* %x, align 4 - store float 0x7FF8000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0.000000e+00, ptr %x, align 4 + store float 0x7FF8000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -183,17 +183,17 @@ return: ; preds = %entry define void @foo10() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0.000000e+00, float* %x, align 4 - store float 0x7FF0000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0.000000e+00, ptr %x, align 4 + store float 0x7FF0000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -202,17 +202,17 @@ return: ; preds = %entry define void @foo11() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0.000000e+00, float* %x, align 4 - store float 0.000000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0.000000e+00, ptr %x, align 4 + store float 0.000000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -221,17 +221,17 @@ return: ; preds = %entry define void @foo12() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 0.000000e+00, float* %x, align 4 - store float 3.500000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 0.000000e+00, ptr %x, align 4 + store float 3.500000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -240,17 +240,17 @@ return: ; preds = %entry define void @foo13() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 3.500000e+00, float* %x, align 4 - store float 0x7FF8000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 3.500000e+00, ptr %x, align 4 + store float 0x7FF8000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -259,17 +259,17 @@ return: ; preds = %entry define void @foo14() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 3.500000e+00, float* %x, align 4 - store float 0x7FF0000000000000, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 3.500000e+00, ptr %x, align 4 + store float 0x7FF0000000000000, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -278,17 +278,17 @@ return: ; preds = %entry define void @foo15() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 3.500000e+00, float* %x, align 4 - store float 0.000000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 3.500000e+00, ptr %x, align 4 + store float 0.000000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry @@ -297,17 +297,17 @@ return: ; preds = %entry define void @foo16() nounwind { entry: - %y = alloca float ; [#uses=2] - %x = alloca float ; [#uses=2] + %y = alloca float ; [#uses=2] + %x = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store float 3.500000e+00, float* %x, align 4 - store float 3.500000e+00, float* %y, align 4 - %0 = load float, float* %y, align 4 ; [#uses=1] + store float 3.500000e+00, ptr %x, align 4 + store float 3.500000e+00, ptr %y, align 4 + %0 = load float, ptr %y, align 4 ; [#uses=1] %1 = fpext float %0 to double ; [#uses=1] - %2 = load float, float* %x, align 4 ; [#uses=1] + %2 = load float, ptr %x, align 4 ; [#uses=1] %3 = fpext float %2 to double ; [#uses=1] %4 = frem double %3, %1 ; [#uses=1] - %5 = call i32 (i8*, ...) @printf(i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; [#uses=0] + %5 = call i32 (ptr, ...) @printf(ptr @"\01LC", double %4) nounwind ; [#uses=0] br label %return return: ; preds = %entry diff --git a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll index 58f84f43374ad..8bf2ef350c727 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll @@ -8,68 +8,68 @@ target triple = "i386-apple-darwin9.6" define float @test1() nounwind { entry: - %retval = alloca float ; [#uses=2] - %0 = alloca float ; [#uses=2] + %retval = alloca float ; [#uses=2] + %0 = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] %1 = frem double 1.000000e-01, 1.000000e+00 ; [#uses=1] %2 = fptrunc double %1 to float ; [#uses=1] - store float %2, float* %0, align 4 - %3 = load float, float* %0, align 4 ; [#uses=1] - store float %3, float* %retval, align 4 + store float %2, ptr %0, align 4 + %3 = load float, ptr %0, align 4 ; [#uses=1] + store float %3, ptr %retval, align 4 br label %return return: ; preds = %entry - %retval1 = load float, float* %retval ; [#uses=1] + %retval1 = load float, ptr %retval ; [#uses=1] ret float %retval1 } define float @test2() nounwind { entry: - %retval = alloca float ; [#uses=2] - %0 = alloca float ; [#uses=2] + %retval = alloca float ; [#uses=2] + %0 = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] %1 = frem double -1.000000e-01, 1.000000e+00 ; [#uses=1] %2 = fptrunc double %1 to float ; [#uses=1] - store float %2, float* %0, align 4 - %3 = load float, float* %0, align 4 ; [#uses=1] - store float %3, float* %retval, align 4 + store float %2, ptr %0, align 4 + %3 = load float, ptr %0, align 4 ; [#uses=1] + store float %3, ptr %retval, align 4 br label %return return: ; preds = %entry - %retval1 = load float, float* %retval ; [#uses=1] + %retval1 = load float, ptr %retval ; [#uses=1] ret float %retval1 } define float @test3() nounwind { entry: - %retval = alloca float ; [#uses=2] - %0 = alloca float ; [#uses=2] + %retval = alloca float ; [#uses=2] + %0 = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] %1 = frem double 1.000000e-01, -1.000000e+00 ; [#uses=1] %2 = fptrunc double %1 to float ; [#uses=1] - store float %2, float* %0, align 4 - %3 = load float, float* %0, align 4 ; [#uses=1] - store float %3, float* %retval, align 4 + store float %2, ptr %0, align 4 + %3 = load float, ptr %0, align 4 ; [#uses=1] + store float %3, ptr %retval, align 4 br label %return return: ; preds = %entry - %retval1 = load float, float* %retval ; [#uses=1] + %retval1 = load float, ptr %retval ; [#uses=1] ret float %retval1 } define float @test4() nounwind { entry: - %retval = alloca float ; [#uses=2] - %0 = alloca float ; [#uses=2] + %retval = alloca float ; [#uses=2] + %0 = alloca float ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] %1 = frem double -1.000000e-01, -1.000000e+00 ; [#uses=1] %2 = fptrunc double %1 to float ; [#uses=1] - store float %2, float* %0, align 4 - %3 = load float, float* %0, align 4 ; [#uses=1] - store float %3, float* %retval, align 4 + store float %2, ptr %0, align 4 + %3 = load float, ptr %0, align 4 ; [#uses=1] + store float %3, ptr %retval, align 4 br label %return return: ; preds = %entry - %retval1 = load float, float* %retval ; [#uses=1] + %retval1 = load float, ptr %retval ; [#uses=1] ret float %retval1 } diff --git a/llvm/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll b/llvm/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll index ecce1505cdc86..477f8cb6dce7d 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll @@ -4,15 +4,14 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-unknown-linux-gnu" %struct.atomic_t = type { i32 } %struct.inode = type { i32, %struct.mutex } - %struct.list_head = type { %struct.list_head*, %struct.list_head* } + %struct.list_head = type { ptr, ptr } %struct.lock_class_key = type { } %struct.mutex = type { %struct.atomic_t, %struct.rwlock_t, %struct.list_head } %struct.rwlock_t = type { %struct.lock_class_key } -define void @handle_event(%struct.inode* %bar) nounwind { +define void @handle_event(ptr %bar) nounwind { entry: - %0 = getelementptr %struct.inode, %struct.inode* %bar, i64 -1, i32 1, i32 1 ; <%struct.rwlock_t*> [#uses=1] - %1 = bitcast %struct.rwlock_t* %0 to i32* ; [#uses=1] - store i32 1, i32* %1, align 4 + %0 = getelementptr %struct.inode, ptr %bar, i64 -1, i32 1, i32 1 ; [#uses=1] + store i32 1, ptr %0, align 4 ret void } diff --git a/llvm/test/Transforms/InstCombine/2009-01-31-InfIterate.ll b/llvm/test/Transforms/InstCombine/2009-01-31-InfIterate.ll index a38714027022e..75f5115d23d3b 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-31-InfIterate.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-31-InfIterate.ll @@ -1,11 +1,11 @@ ; RUN: opt < %s -passes=instcombine | llvm-dis ; PR3452 -define i128 @test(i64 %A, i64 %B, i1 %C, i128 %Z, i128 %Y, i64* %P, i64* %Q) { +define i128 @test(i64 %A, i64 %B, i1 %C, i128 %Z, i128 %Y, ptr %P, ptr %Q) { entry: %tmp2 = trunc i128 %Z to i64 %tmp4 = trunc i128 %Y to i64 - store i64 %tmp2, i64* %P - store i64 %tmp4, i64* %Q + store i64 %tmp2, ptr %P + store i64 %tmp4, ptr %Q %x = sub i64 %tmp2, %tmp4 %c = sub i64 %tmp2, %tmp4 %tmp137 = zext i1 %C to i64 diff --git a/llvm/test/Transforms/InstCombine/2009-02-11-NotInitialized.ll b/llvm/test/Transforms/InstCombine/2009-02-11-NotInitialized.ll index ceffb8941de86..d87033f952a02 100644 --- a/llvm/test/Transforms/InstCombine/2009-02-11-NotInitialized.ll +++ b/llvm/test/Transforms/InstCombine/2009-02-11-NotInitialized.ll @@ -3,12 +3,12 @@ ; Check that nocapture attributes are added when run after an SCC pass. ; PR3520 -define i32 @use(i8* %x) nounwind readonly { -; CHECK: @use(i8* nocapture %x) - %1 = tail call i64 @strlen(i8* %x) nounwind readonly +define i32 @use(ptr %x) nounwind readonly { +; CHECK: @use(ptr nocapture %x) + %1 = tail call i64 @strlen(ptr %x) nounwind readonly %2 = trunc i64 %1 to i32 ret i32 %2 } -declare i64 @strlen(i8*) nounwind readonly -; CHECK: declare i64 @strlen(i8* nocapture) nounwind readonly +declare i64 @strlen(ptr) nounwind readonly +; CHECK: declare i64 @strlen(ptr nocapture) nounwind readonly diff --git a/llvm/test/Transforms/InstCombine/2009-02-21-LoadCST.ll b/llvm/test/Transforms/InstCombine/2009-02-21-LoadCST.ll index 5e2ac42b4d7df..9c515f07f31fa 100644 --- a/llvm/test/Transforms/InstCombine/2009-02-21-LoadCST.ll +++ b/llvm/test/Transforms/InstCombine/2009-02-21-LoadCST.ll @@ -7,6 +7,6 @@ target triple = "i386-pc-linux-gnu" @.str1 = internal constant [4 x i8] c"\B5%8\00" define i32 @test() { - %rhsv = load i32, i32* bitcast ([4 x i8]* @.str1 to i32*), align 1 + %rhsv = load i32, ptr @.str1, align 1 ret i32 %rhsv } diff --git a/llvm/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll b/llvm/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll index c26167667c8d7..3ae6f0095fc6f 100644 --- a/llvm/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll +++ b/llvm/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll @@ -3,24 +3,20 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" -define void @_ada_c32001b(i32 %tmp5, i32* %src) { +define void @_ada_c32001b(i32 %tmp5, ptr %src) { entry: %max289 = select i1 false, i32 %tmp5, i32 0 ; [#uses=1] %tmp6 = mul i32 %max289, 4 ; [#uses=1] - %tmp7 = alloca i8, i32 0 ; [#uses=1] - %tmp8 = bitcast i8* %tmp7 to [0 x [0 x i32]]* ; <[0 x [0 x i32]]*> [#uses=1] - %tmp11 = load i32, i32* %src, align 1 ; [#uses=1] + %tmp7 = alloca i8, i32 0 ; [#uses=1] + %tmp11 = load i32, ptr %src, align 1 ; [#uses=1] %tmp12 = icmp eq i32 %tmp11, 3 ; [#uses=1] %tmp13 = zext i1 %tmp12 to i8 ; [#uses=1] %tmp14 = ashr i32 %tmp6, 2 ; [#uses=1] - %tmp15 = bitcast [0 x [0 x i32]]* %tmp8 to i8* ; [#uses=1] %tmp16 = mul i32 %tmp14, 4 ; [#uses=1] %tmp17 = mul i32 1, %tmp16 ; [#uses=1] - %tmp18 = getelementptr i8, i8* %tmp15, i32 %tmp17 ; [#uses=1] - %tmp19 = bitcast i8* %tmp18 to [0 x i32]* ; <[0 x i32]*> [#uses=1] - %tmp20 = bitcast [0 x i32]* %tmp19 to i32* ; [#uses=1] - %tmp21 = getelementptr i32, i32* %tmp20, i32 0 ; [#uses=1] - %tmp22 = load i32, i32* %tmp21, align 1 ; [#uses=1] + %tmp18 = getelementptr i8, ptr %tmp7, i32 %tmp17 ; [#uses=1] + %tmp21 = getelementptr i32, ptr %tmp18, i32 0 ; [#uses=1] + %tmp22 = load i32, ptr %tmp21, align 1 ; [#uses=1] %tmp23 = icmp eq i32 %tmp22, 4 ; [#uses=1] %tmp24 = zext i1 %tmp23 to i8 ; [#uses=1] %toBool709 = icmp ne i8 %tmp13, 0 ; [#uses=1] diff --git a/llvm/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll b/llvm/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll index 3cf9c48dfe2bb..7227fa5e20213 100644 --- a/llvm/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll +++ b/llvm/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll @@ -1,11 +1,11 @@ ; RUN: opt < %s -passes=instcombine | llvm-dis ; PR3826 -define void @0(<4 x i16>*, <4 x i16>*) { - %3 = alloca <4 x i16>* ; <<4 x i16>**> [#uses=1] - %4 = load <4 x i16>, <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1] +define void @0(ptr, ptr) { + %3 = alloca ptr ; [#uses=1] + %4 = load <4 x i16>, ptr null, align 1 ; <<4 x i16>> [#uses=1] %5 = ashr <4 x i16> %4, ; <<4 x i16>> [#uses=1] - %6 = load <4 x i16>*, <4 x i16>** %3 ; <<4 x i16>*> [#uses=1] - store <4 x i16> %5, <4 x i16>* %6, align 1 + %6 = load ptr, ptr %3 ; [#uses=1] + store <4 x i16> %5, ptr %6, align 1 ret void } diff --git a/llvm/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll b/llvm/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll index b0d5ec54eeb6b..7f32f947aa216 100644 --- a/llvm/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll +++ b/llvm/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll @@ -1,8 +1,8 @@ ; RUN: opt < %s -passes=instcombine -S | not grep cmp ; rdar://6903175 -define i1 @f0(i32 *%a) nounwind { - %b = load i32, i32* %a, align 4 +define i1 @f0(ptr %a) nounwind { + %b = load i32, ptr %a, align 4 %c = uitofp i32 %b to double %d = fcmp ogt double %c, 0x41EFFFFFFFE00000 ret i1 %d diff --git a/llvm/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll b/llvm/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll index 61191f9ae352a..0bfa8e97cfc68 100644 --- a/llvm/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll +++ b/llvm/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll @@ -2,6 +2,6 @@ ; PR4366 define void @a() { - store i32 0, i32 addrspace(1)* null + store i32 0, ptr addrspace(1) null ret void } diff --git a/llvm/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll b/llvm/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll index e549086166987..10fae95b0a15c 100644 --- a/llvm/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll +++ b/llvm/test/Transforms/InstCombine/2009-12-17-CmpSelectNull.ll @@ -3,14 +3,14 @@ @.str254 = internal constant [2 x i8] c".\00" @.str557 = internal constant [3 x i8] c"::\00" -define i8* @demangle_qualified(i32 %isfuncname) nounwind { +define ptr @demangle_qualified(i32 %isfuncname) nounwind { entry: %tobool272 = icmp ne i32 %isfuncname, 0 - %cond276 = select i1 %tobool272, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str254, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str557, i32 0, i32 0) ; [#uses=4] - %cmp.i504 = icmp eq i8* %cond276, null - %rval = getelementptr i8, i8* %cond276, i1 %cmp.i504 - ret i8* %rval + %cond276 = select i1 %tobool272, ptr @.str254, ptr @.str557 ; [#uses=4] + %cmp.i504 = icmp eq ptr %cond276, null + %rval = getelementptr i8, ptr %cond276, i1 %cmp.i504 + ret ptr %rval } ; CHECK: %cond276 = select i1 -; CHECK: ret i8* %cond276 +; CHECK: ret ptr %cond276 diff --git a/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll b/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll index e802cf62c6d1d..c9b2d6b41aa9c 100644 --- a/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll +++ b/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll @@ -3,13 +3,13 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" target triple = "i386-unknown-linux-gnu" -@g_92 = common global [2 x i32*] zeroinitializer, align 4 ; <[2 x i32*]*> [#uses=1] -@g_177 = constant i32** bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i32*]* @g_92 to i8*), i64 4) to i32**), align 4 ; [#uses=1] +@g_92 = common global [2 x ptr] zeroinitializer, align 4 ; [#uses=1] +@g_177 = constant ptr getelementptr (i8, ptr @g_92, i64 4), align 4 ; [#uses=1] define i1 @PR6486() nounwind { ; CHECK-LABEL: @PR6486( - %tmp = load i32**, i32*** @g_177 ; [#uses=1] - %cmp = icmp ne i32** null, %tmp ; [#uses=1] + %tmp = load ptr, ptr @g_177 ; [#uses=1] + %cmp = icmp ne ptr null, %tmp ; [#uses=1] %conv = zext i1 %cmp to i32 ; [#uses=1] %cmp1 = icmp sle i32 0, %conv ; [#uses=1] ret i1 %cmp1 @@ -21,12 +21,12 @@ define i1 @PR6486() nounwind { define i1 @PR16462_1() nounwind { ; CHECK-LABEL: @PR16462_1( - ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 65535) + ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1) to i16) to i32), i32 65535) ; CHECK: ret i1 false } define i1 @PR16462_2() nounwind { ; CHECK-LABEL: @PR16462_2( - ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (i32* getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0), i32* @d), i32 0, i32 1) to i16) to i32), i32 42) + ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1) to i16) to i32), i32 42) ; CHECK: ret i1 false } diff --git a/llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll b/llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll index a1c71f06ac1b4..53100cd651788 100644 --- a/llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll +++ b/llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll @@ -9,17 +9,16 @@ target triple = "x86_64-unknown-linux-gnu" @.str = private constant [3 x i8] c"%s\00" -define void @CopyEventArg(%union.anon* %ev, i8* %src) nounwind { +define void @CopyEventArg(ptr %ev, ptr %src) nounwind { ; CHECK-LABEL: @CopyEventArg( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CSTR:%.*]] = bitcast %union.anon* [[EV:%.*]] to i8* -; CHECK-NEXT: [[STRCPY:%.*]] = call i8* @strcpy(i8* noundef nonnull dereferenceable(1) [[SRC:%.*]], i8* noundef nonnull dereferenceable(1) [[CSTR]]) +; CHECK-NEXT: [[STRCPY:%.*]] = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) [[SRC:%.*]], ptr noundef nonnull dereferenceable(1) [[EV:%.*]]) ; CHECK-NEXT: ret void ; entry: - %call = call i32 (i8*, i8*, ...) @sprintf(i8* %src, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %union.anon* %ev) nounwind + %call = call i32 (ptr, ptr, ...) @sprintf(ptr %src, ptr @.str, ptr %ev) nounwind ret void } -declare i32 @sprintf(i8*, i8*, ...) +declare i32 @sprintf(ptr, ptr, ...) diff --git a/llvm/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll b/llvm/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll index c3a078a9bfdef..608a1588406e0 100644 --- a/llvm/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll +++ b/llvm/test/Transforms/InstCombine/2010-11-21-SizeZeroTypeGEP.ll @@ -2,16 +2,16 @@ target 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" -define {}* @foo({}* %x, i32 %n) { +define ptr @foo(ptr %x, i32 %n) { ; CHECK-LABEL: @foo( ; CHECK-NOT: getelementptr - %p = getelementptr {}, {}* %x, i32 %n - ret {}* %p + %p = getelementptr {}, ptr %x, i32 %n + ret ptr %p } -define i8* @bar(i64 %n, {{}, [0 x {[0 x i8]}]}* %p) { +define ptr @bar(i64 %n, ptr %p) { ; CHECK-LABEL: @bar( - %g = getelementptr {{}, [0 x {[0 x i8]}]}, {{}, [0 x {[0 x i8]}]}* %p, i64 %n, i32 1, i64 %n, i32 0, i64 %n + %g = getelementptr {{}, [0 x {[0 x i8]}]}, ptr %p, i64 %n, i32 1, i64 %n, i32 0, i64 %n ; CHECK: %p, i64 0, i32 1, i64 0, i32 0, i64 %n - ret i8* %g + ret ptr %g } diff --git a/llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll b/llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll index 7faf952e9eb14..98f716d6d7b70 100644 --- a/llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll +++ b/llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll @@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu" -define <4 x float> @m_387(i8* noalias nocapture %A, i8* nocapture %B, <4 x i1> %C) nounwind { +define <4 x float> @m_387(ptr noalias nocapture %A, ptr nocapture %B, <4 x i1> %C) nounwind { entry: %movcsext20 = sext <4 x i1> %C to <4 x i32> %tmp2389 = xor <4 x i32> %movcsext20, diff --git a/llvm/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll b/llvm/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll index 3bca0de3bc3e5..b34c4c2a32213 100644 --- a/llvm/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll +++ b/llvm/test/Transforms/InstCombine/2011-05-02-VectorBoolean.ll @@ -5,10 +5,10 @@ define <2 x i16> @entry(<2 x i16> %a) nounwind { entry: %a.addr = alloca <2 x i16>, align 4 %.compoundliteral = alloca <2 x i16>, align 4 - store <2 x i16> %a, <2 x i16>* %a.addr, align 4 - %tmp = load <2 x i16>, <2 x i16>* %a.addr, align 4 - store <2 x i16> zeroinitializer, <2 x i16>* %.compoundliteral - %tmp1 = load <2 x i16>, <2 x i16>* %.compoundliteral + store <2 x i16> %a, ptr %a.addr, align 4 + %tmp = load <2 x i16>, ptr %a.addr, align 4 + store <2 x i16> zeroinitializer, ptr %.compoundliteral + %tmp1 = load <2 x i16>, ptr %.compoundliteral %cmp = icmp uge <2 x i16> %tmp, %tmp1 %sext = sext <2 x i1> %cmp to <2 x i16> ret <2 x i16> %sext diff --git a/llvm/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll b/llvm/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll index 29e5fb27a4b9d..2aba273da9269 100644 --- a/llvm/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll +++ b/llvm/test/Transforms/InstCombine/2011-05-13-InBoundsGEP.ll @@ -9,10 +9,10 @@ entry: %tmp2 = add i32 %argc, 1879048192 %p = alloca i8 ; CHECK: getelementptr - %p1 = getelementptr i8, i8* %p, i32 %tmp1 + %p1 = getelementptr i8, ptr %p, i32 %tmp1 ; CHECK: getelementptr - %p2 = getelementptr i8, i8* %p, i32 %tmp2 - %cmp = icmp ult i8* %p1, %p2 + %p2 = getelementptr i8, ptr %p, i32 %tmp2 + %cmp = icmp ult ptr %p1, %p2 br i1 %cmp, label %bbtrue, label %bbfalse bbtrue: ; preds = %entry ret i32 -1 diff --git a/llvm/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll b/llvm/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll index a9b7de5e7b88d..ac7c17d12bf07 100644 --- a/llvm/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll +++ b/llvm/test/Transforms/InstCombine/2011-05-28-swapmulsub.ll @@ -11,12 +11,12 @@ define zeroext i16 @foo1(i32 %on_off) { ; %on_off.addr = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %on_off, i32* %on_off.addr, align 4 - %tmp = load i32, i32* %on_off.addr, align 4 + store i32 %on_off, ptr %on_off.addr, align 4 + %tmp = load i32, ptr %on_off.addr, align 4 %sub = sub i32 1, %tmp %mul = mul i32 %sub, -2 - store i32 %mul, i32* %a, align 4 - %tmp1 = load i32, i32* %a, align 4 + store i32 %mul, ptr %a, align 4 + %tmp1 = load i32, ptr %a, align 4 %conv = trunc i32 %tmp1 to i16 ret i16 %conv } @@ -31,14 +31,14 @@ define zeroext i16 @foo2(i32 %on_off, i32 %q) { %on_off.addr = alloca i32, align 4 %q.addr = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %on_off, i32* %on_off.addr, align 4 - store i32 %q, i32* %q.addr, align 4 - %tmp = load i32, i32* %q.addr, align 4 - %tmp1 = load i32, i32* %on_off.addr, align 4 + store i32 %on_off, ptr %on_off.addr, align 4 + store i32 %q, ptr %q.addr, align 4 + %tmp = load i32, ptr %q.addr, align 4 + %tmp1 = load i32, ptr %on_off.addr, align 4 %sub = sub i32 %tmp, %tmp1 %mul = mul i32 %sub, -4 - store i32 %mul, i32* %a, align 4 - %tmp2 = load i32, i32* %a, align 4 + store i32 %mul, ptr %a, align 4 + %tmp2 = load i32, ptr %a, align 4 %conv = trunc i32 %tmp2 to i16 ret i16 %conv } @@ -52,12 +52,12 @@ define zeroext i16 @foo3(i32 %on_off) { ; %on_off.addr = alloca i32, align 4 %a = alloca i32, align 4 - store i32 %on_off, i32* %on_off.addr, align 4 - %tmp = load i32, i32* %on_off.addr, align 4 + store i32 %on_off, ptr %on_off.addr, align 4 + %tmp = load i32, ptr %on_off.addr, align 4 %sub = sub i32 7, %tmp %mul = mul i32 %sub, -4 - store i32 %mul, i32* %a, align 4 - %tmp1 = load i32, i32* %a, align 4 + store i32 %mul, ptr %a, align 4 + %tmp1 = load i32, ptr %a, align 4 %conv = trunc i32 %tmp1 to i16 ret i16 %conv } diff --git a/llvm/test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll b/llvm/test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll index 515d26dac8baa..0aee53b80eb64 100644 --- a/llvm/test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll +++ b/llvm/test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll @@ -4,9 +4,9 @@ @G = external global [0 x %opaque_struct] -declare void @foo(%opaque_struct*) +declare void @foo(ptr) define void @bar() { - call void @foo(%opaque_struct* bitcast ([0 x %opaque_struct]* @G to %opaque_struct*)) + call void @foo(ptr @G) ret void } diff --git a/llvm/test/Transforms/InstCombine/2012-02-13-FCmp.ll b/llvm/test/Transforms/InstCombine/2012-02-13-FCmp.ll index d839e19129e16..7366b50ed4b51 100644 --- a/llvm/test/Transforms/InstCombine/2012-02-13-FCmp.ll +++ b/llvm/test/Transforms/InstCombine/2012-02-13-FCmp.ll @@ -3,12 +3,12 @@ @.str = private unnamed_addr constant [35 x i8] c"\0Ain_range input (should be 0): %f\0A\00", align 1 @.str1 = external hidden unnamed_addr constant [35 x i8], align 1 -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) define i64 @_Z8tempCastj(i32 %val) uwtable ssp { entry: - %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str1, i64 0, i64 0), i32 %val) + %call = call i32 (ptr, ...) @printf(ptr @.str1, i32 %val) %conv = uitofp i32 %val to double - %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %conv) + %call.i = call i32 (ptr, ...) @printf(ptr @.str, double %conv) %cmp.i = fcmp oge double %conv, -1.000000e+00 br i1 %cmp.i, label %land.rhs.i, label %if.end.critedge ; CHECK: br i1 true, label %land.rhs.i, label %if.end.critedge diff --git a/llvm/test/Transforms/InstCombine/2012-03-10-InstCombine.ll b/llvm/test/Transforms/InstCombine/2012-03-10-InstCombine.ll index de2ed86d480b7..9a2d5e6aa2ea3 100644 --- a/llvm/test/Transforms/InstCombine/2012-03-10-InstCombine.ll +++ b/llvm/test/Transforms/InstCombine/2012-03-10-InstCombine.ll @@ -3,21 +3,21 @@ ; Derived from gcc.c-torture/execute/frame-address.c -define i32 @func(i8* %c, i8* %f) nounwind uwtable readnone noinline ssp { +define i32 @func(ptr %c, ptr %f) nounwind uwtable readnone noinline ssp { ; CHECK-LABEL: @func( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[D:%.*]] = alloca i8, align 1 -; CHECK-NEXT: store i8 0, i8* [[D]], align 1 -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[D]], [[C:%.*]] +; CHECK-NEXT: store i8 0, ptr [[D]], align 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[D]], [[C:%.*]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8* [[D]], [[F:%.*]] -; CHECK-NEXT: [[NOT_CMP1:%.*]] = icmp uge i8* [[C]], [[F]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp ule ptr [[D]], [[F:%.*]] +; CHECK-NEXT: [[NOT_CMP1:%.*]] = icmp uge ptr [[C]], [[F]] ; CHECK-NEXT: [[DOTCMP2:%.*]] = and i1 [[CMP2]], [[NOT_CMP1]] ; CHECK-NEXT: br label [[RETURN:%.*]] ; CHECK: if.else: -; CHECK-NEXT: [[CMP5:%.*]] = icmp uge i8* [[D]], [[F]] -; CHECK-NEXT: [[NOT_CMP3:%.*]] = icmp ule i8* [[C]], [[F]] +; CHECK-NEXT: [[CMP5:%.*]] = icmp uge ptr [[D]], [[F]] +; CHECK-NEXT: [[NOT_CMP3:%.*]] = icmp ule ptr [[C]], [[F]] ; CHECK-NEXT: [[DOTCMP5:%.*]] = and i1 [[CMP5]], [[NOT_CMP3]] ; CHECK-NEXT: br label [[RETURN]] ; CHECK: return: @@ -27,20 +27,20 @@ define i32 @func(i8* %c, i8* %f) nounwind uwtable readnone noinline ssp { ; entry: %d = alloca i8, align 1 - store i8 0, i8* %d, align 1 - %cmp = icmp ugt i8* %d, %c + store i8 0, ptr %d, align 1 + %cmp = icmp ugt ptr %d, %c br i1 %cmp, label %if.else, label %if.then if.then: ; preds = %entry - %cmp2 = icmp ule i8* %d, %f - %not.cmp1 = icmp uge i8* %c, %f + %cmp2 = icmp ule ptr %d, %f + %not.cmp1 = icmp uge ptr %c, %f %.cmp2 = and i1 %cmp2, %not.cmp1 %land.ext = zext i1 %.cmp2 to i32 br label %return if.else: ; preds = %entry - %cmp5 = icmp uge i8* %d, %f - %not.cmp3 = icmp ule i8* %c, %f + %cmp5 = icmp uge ptr %d, %f + %not.cmp3 = icmp ule ptr %c, %f %.cmp5 = and i1 %cmp5, %not.cmp3 %land.ext7 = zext i1 %.cmp5 to i32 br label %return @@ -50,21 +50,21 @@ return: ; preds = %if.else, %if.then ret i32 %retval.0 } -define i32 @func_logical(i8* %c, i8* %f) nounwind uwtable readnone noinline ssp { +define i32 @func_logical(ptr %c, ptr %f) nounwind uwtable readnone noinline ssp { ; CHECK-LABEL: @func_logical( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[D:%.*]] = alloca i8, align 1 -; CHECK-NEXT: store i8 0, i8* [[D]], align 1 -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[D]], [[C:%.*]] +; CHECK-NEXT: store i8 0, ptr [[D]], align 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[D]], [[C:%.*]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8* [[D]], [[F:%.*]] -; CHECK-NEXT: [[NOT_CMP1:%.*]] = icmp uge i8* [[C]], [[F]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp ule ptr [[D]], [[F:%.*]] +; CHECK-NEXT: [[NOT_CMP1:%.*]] = icmp uge ptr [[C]], [[F]] ; CHECK-NEXT: [[DOTCMP2:%.*]] = select i1 [[CMP2]], i1 [[NOT_CMP1]], i1 false ; CHECK-NEXT: br label [[RETURN:%.*]] ; CHECK: if.else: -; CHECK-NEXT: [[CMP5:%.*]] = icmp uge i8* [[D]], [[F]] -; CHECK-NEXT: [[NOT_CMP3:%.*]] = icmp ule i8* [[C]], [[F]] +; CHECK-NEXT: [[CMP5:%.*]] = icmp uge ptr [[D]], [[F]] +; CHECK-NEXT: [[NOT_CMP3:%.*]] = icmp ule ptr [[C]], [[F]] ; CHECK-NEXT: [[DOTCMP5:%.*]] = select i1 [[CMP5]], i1 [[NOT_CMP3]], i1 false ; CHECK-NEXT: br label [[RETURN]] ; CHECK: return: @@ -74,20 +74,20 @@ define i32 @func_logical(i8* %c, i8* %f) nounwind uwtable readnone noinline ssp ; entry: %d = alloca i8, align 1 - store i8 0, i8* %d, align 1 - %cmp = icmp ugt i8* %d, %c + store i8 0, ptr %d, align 1 + %cmp = icmp ugt ptr %d, %c br i1 %cmp, label %if.else, label %if.then if.then: ; preds = %entry - %cmp2 = icmp ule i8* %d, %f - %not.cmp1 = icmp uge i8* %c, %f + %cmp2 = icmp ule ptr %d, %f + %not.cmp1 = icmp uge ptr %c, %f %.cmp2 = select i1 %cmp2, i1 %not.cmp1, i1 false %land.ext = zext i1 %.cmp2 to i32 br label %return if.else: ; preds = %entry - %cmp5 = icmp uge i8* %d, %f - %not.cmp3 = icmp ule i8* %c, %f + %cmp5 = icmp uge ptr %d, %f + %not.cmp3 = icmp ule ptr %c, %f %.cmp5 = select i1 %cmp5, i1 %not.cmp3, i1 false %land.ext7 = zext i1 %.cmp5 to i32 br label %return diff --git a/llvm/test/Transforms/InstCombine/2012-05-28-select-hang.ll b/llvm/test/Transforms/InstCombine/2012-05-28-select-hang.ll index 7828778b89017..b4efe6126763e 100644 --- a/llvm/test/Transforms/InstCombine/2012-05-28-select-hang.ll +++ b/llvm/test/Transforms/InstCombine/2012-05-28-select-hang.ll @@ -6,17 +6,17 @@ define void @func() nounwind uwtable ssp { entry: - %0 = load i8, i8* @c, align 1 + %0 = load i8, ptr @c, align 1 %conv = zext i8 %0 to i32 %or = or i32 %conv, 1 %conv1 = trunc i32 %or to i8 - store i8 %conv1, i8* @a, align 1 + store i8 %conv1, ptr @a, align 1 %conv2 = zext i8 %conv1 to i32 %neg = xor i32 %conv2, -1 %and = and i32 1, %neg %conv3 = trunc i32 %and to i8 - store i8 %conv3, i8* @b, align 1 - %1 = load i8, i8* @a, align 1 + store i8 %conv3, ptr @b, align 1 + %1 = load i8, ptr @a, align 1 %conv4 = zext i8 %1 to i32 %conv5 = zext i8 %conv3 to i32 %tobool = icmp ne i32 %conv4, 0 @@ -31,7 +31,7 @@ land.end: ; preds = %land.rhs, %entry %land.ext = zext i1 %2 to i32 %mul = mul nsw i32 3, %land.ext %conv9 = trunc i32 %mul to i8 - store i8 %conv9, i8* @a, align 1 + store i8 %conv9, ptr @a, align 1 ret void ; CHECK-LABEL: @func( diff --git a/llvm/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll b/llvm/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll index 76b60d4409b47..b3a4b4fbdf853 100644 --- a/llvm/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll +++ b/llvm/test/Transforms/InstCombine/2012-06-06-LoadOfPHIs.ll @@ -1,14 +1,14 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; -define void @func(double %r, double %g, double %b, double* %outH, double* %outS, double* %outL) nounwind uwtable ssp { +define void @func(double %r, double %g, double %b, ptr %outH, ptr %outS, ptr %outL) nounwind uwtable ssp { bb: %tmp = alloca double, align 8 %tmp1 = alloca double, align 8 %tmp2 = alloca double, align 8 - store double %r, double* %tmp, align 8 - store double %g, double* %tmp1, align 8 - store double %b, double* %tmp2, align 8 + store double %r, ptr %tmp, align 8 + store double %g, ptr %tmp1, align 8 + store double %b, ptr %tmp2, align 8 %tmp3 = fcmp ogt double %r, %g br i1 %tmp3, label %bb4, label %bb8 @@ -33,17 +33,17 @@ bb11: ; preds = %bb8 br label %bb12 bb12: ; preds = %bb11, %bb10, %bb7, %bb6 - %max.0 = phi double* [ %tmp, %bb6 ], [ %tmp2, %bb7 ], [ %tmp1, %bb10 ], [ %tmp2, %bb11 ] -; CHECK: %tmp13 = load double, double* %tmp, align 8 -; CHECK: %tmp14 = load double, double* %tmp1, align 8 + %max.0 = phi ptr [ %tmp, %bb6 ], [ %tmp2, %bb7 ], [ %tmp1, %bb10 ], [ %tmp2, %bb11 ] +; CHECK: %tmp13 = load double, ptr %tmp, align 8 +; CHECK: %tmp14 = load double, ptr %tmp1, align 8 ; CHECK: %tmp15 = fcmp olt double %tmp13, %tmp14 - %tmp13 = load double, double* %tmp, align 8 - %tmp14 = load double, double* %tmp1, align 8 + %tmp13 = load double, ptr %tmp, align 8 + %tmp14 = load double, ptr %tmp1, align 8 %tmp15 = fcmp olt double %tmp13, %tmp14 br i1 %tmp15, label %bb16, label %bb21 bb16: ; preds = %bb12 - %tmp17 = load double, double* %tmp2, align 8 + %tmp17 = load double, ptr %tmp2, align 8 %tmp18 = fcmp olt double %tmp13, %tmp17 br i1 %tmp18, label %bb19, label %bb20 @@ -54,7 +54,7 @@ bb20: ; preds = %bb16 br label %bb26 bb21: ; preds = %bb12 - %tmp22 = load double, double* %tmp2, align 8 + %tmp22 = load double, ptr %tmp2, align 8 %tmp23 = fcmp olt double %tmp14, %tmp22 br i1 %tmp23, label %bb24, label %bb25 @@ -65,23 +65,23 @@ bb25: ; preds = %bb21 br label %bb26 bb26: ; preds = %bb25, %bb24, %bb20, %bb19 - %min.0 = phi double* [ %tmp, %bb19 ], [ %tmp2, %bb20 ], [ %tmp1, %bb24 ], [ %tmp2, %bb25 ] -; CHECK: %tmp27 = load double, double* %min.0, align 8 -; CHECK: %tmp28 = load double, double* %max.0 + %min.0 = phi ptr [ %tmp, %bb19 ], [ %tmp2, %bb20 ], [ %tmp1, %bb24 ], [ %tmp2, %bb25 ] +; CHECK: %tmp27 = load double, ptr %min.0, align 8 +; CHECK: %tmp28 = load double, ptr %max.0 ; CHECK: %tmp29 = fadd double %tmp27, %tmp28 - %tmp27 = load double, double* %min.0, align 8 - %tmp28 = load double, double* %max.0 + %tmp27 = load double, ptr %min.0, align 8 + %tmp28 = load double, ptr %max.0 %tmp29 = fadd double %tmp27, %tmp28 %tmp30 = fdiv double %tmp29, 2.000000e+00 - store double %tmp30, double* %outL - %tmp31 = load double, double* %min.0 - %tmp32 = load double, double* %max.0 + store double %tmp30, ptr %outL + %tmp31 = load double, ptr %min.0 + %tmp32 = load double, ptr %max.0 %tmp33 = fcmp oeq double %tmp31, %tmp32 br i1 %tmp33, label %bb34, label %bb35 bb34: ; preds = %bb26 - store double 0.000000e+00, double* %outS - store double 0.000000e+00, double* %outH + store double 0.000000e+00, ptr %outS + store double 0.000000e+00, ptr %outH br label %bb81 bb35: ; preds = %bb26 @@ -92,69 +92,69 @@ bb35: ; preds = %bb26 bb38: ; preds = %bb35 %tmp39 = fadd double %tmp32, %tmp31 %tmp40 = fdiv double %tmp37, %tmp39 - store double %tmp40, double* %outS + store double %tmp40, ptr %outS br label %bb45 bb41: ; preds = %bb35 %tmp42 = fsub double 2.000000e+00, %tmp32 %tmp43 = fsub double %tmp42, %tmp31 %tmp44 = fdiv double %tmp37, %tmp43 - store double %tmp44, double* %outS + store double %tmp44, ptr %outS br label %bb45 bb45: ; preds = %bb41, %bb38 - %tmp46 = icmp eq double* %max.0, %tmp + %tmp46 = icmp eq ptr %max.0, %tmp br i1 %tmp46, label %bb47, label %bb55 bb47: ; preds = %bb45 - %tmp48 = load double, double* %tmp1, align 8 - %tmp49 = load double, double* %tmp2, align 8 + %tmp48 = load double, ptr %tmp1, align 8 + %tmp49 = load double, ptr %tmp2, align 8 %tmp50 = fsub double %tmp48, %tmp49 - %tmp51 = load double, double* %max.0 - %tmp52 = load double, double* %min.0 + %tmp51 = load double, ptr %max.0 + %tmp52 = load double, ptr %min.0 %tmp53 = fsub double %tmp51, %tmp52 %tmp54 = fdiv double %tmp50, %tmp53 - store double %tmp54, double* %outH + store double %tmp54, ptr %outH br label %bb75 bb55: ; preds = %bb45 - %tmp56 = icmp eq double* %max.0, %tmp1 + %tmp56 = icmp eq ptr %max.0, %tmp1 br i1 %tmp56, label %bb57, label %bb66 bb57: ; preds = %bb55 - %tmp58 = load double, double* %tmp2, align 8 - %tmp59 = load double, double* %tmp, align 8 + %tmp58 = load double, ptr %tmp2, align 8 + %tmp59 = load double, ptr %tmp, align 8 %tmp60 = fsub double %tmp58, %tmp59 - %tmp61 = load double, double* %max.0 - %tmp62 = load double, double* %min.0 + %tmp61 = load double, ptr %max.0 + %tmp62 = load double, ptr %min.0 %tmp63 = fsub double %tmp61, %tmp62 %tmp64 = fdiv double %tmp60, %tmp63 %tmp65 = fadd double 2.000000e+00, %tmp64 - store double %tmp65, double* %outH + store double %tmp65, ptr %outH br label %bb75 bb66: ; preds = %bb55 - %tmp67 = load double, double* %tmp, align 8 - %tmp68 = load double, double* %tmp1, align 8 + %tmp67 = load double, ptr %tmp, align 8 + %tmp68 = load double, ptr %tmp1, align 8 %tmp69 = fsub double %tmp67, %tmp68 - %tmp70 = load double, double* %max.0 - %tmp71 = load double, double* %min.0 + %tmp70 = load double, ptr %max.0 + %tmp71 = load double, ptr %min.0 %tmp72 = fsub double %tmp70, %tmp71 %tmp73 = fdiv double %tmp69, %tmp72 %tmp74 = fadd double 4.000000e+00, %tmp73 - store double %tmp74, double* %outH + store double %tmp74, ptr %outH br label %bb75 bb75: ; preds = %bb66, %bb57, %bb47 - %tmp76 = load double, double* %outH + %tmp76 = load double, ptr %outH %tmp77 = fdiv double %tmp76, 6.000000e+00 - store double %tmp77, double* %outH + store double %tmp77, ptr %outH %tmp78 = fcmp olt double %tmp77, 0.000000e+00 br i1 %tmp78, label %bb79, label %bb81 bb79: ; preds = %bb75 %tmp80 = fadd double %tmp77, 1.000000e+00 - store double %tmp80, double* %outH + store double %tmp80, ptr %outH br label %bb81 bb81: ; preds = %bb79, %bb75, %bb34 diff --git a/llvm/test/Transforms/InstCombine/2012-07-25-LoadPart.ll b/llvm/test/Transforms/InstCombine/2012-07-25-LoadPart.ll index 338bed0438dbd..dfbe84423abc2 100644 --- a/llvm/test/Transforms/InstCombine/2012-07-25-LoadPart.ll +++ b/llvm/test/Transforms/InstCombine/2012-07-25-LoadPart.ll @@ -5,7 +5,7 @@ @test = constant [4 x i32] [i32 1, i32 2, i32 3, i32 4] define i64 @foo() { - %ret = load i64, i64* bitcast (i8* getelementptr (i8, i8* bitcast ([4 x i32]* @test to i8*), i64 2) to i64*), align 1 + %ret = load i64, ptr getelementptr (i8, ptr @test, i64 2), align 1 ret i64 %ret ; 0x00030000_00020000 in [01 00/00 00 02 00 00 00 03 00/00 00 04 00 00 00] ; LE: ret i64 844424930263040 diff --git a/llvm/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll b/llvm/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll index e911507a51649..6e6bd46348270 100644 --- a/llvm/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll +++ b/llvm/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll @@ -2,9 +2,9 @@ ; CHECK: addrspacecast @base = internal unnamed_addr addrspace(3) global [16 x i32] zeroinitializer, align 16 -declare void @foo(i32*) +declare void @foo(ptr) define void @test() nounwind { - call void @foo(i32* getelementptr (i32, i32* addrspacecast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind + call void @foo(ptr getelementptr (i32, ptr addrspacecast (ptr addrspace(3) @base to ptr), i64 2147483647)) nounwind ret void } diff --git a/llvm/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll b/llvm/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll index 08f79a2350c2d..783c177a8257d 100644 --- a/llvm/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll +++ b/llvm/test/Transforms/InstCombine/2012-09-17-ZeroSizedAlloca.ll @@ -6,8 +6,8 @@ target 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" target triple = "x86_64-apple-macosx10.8.0" -@x = global i8* null, align 8 -@y = global i8* null, align 8 +@x = global ptr null, align 8 +@y = global ptr null, align 8 ; CHECK-LABEL: @f( ; CHECK-NEXT: alloca [0 x i8], align 1024 @@ -16,9 +16,7 @@ target triple = "x86_64-apple-macosx10.8.0" define void @f() { %1 = alloca [0 x i8], align 1 %2 = alloca [0 x i8], align 1024 - %3 = getelementptr inbounds [0 x i8], [0 x i8]* %1, i64 0, i64 0 - %4 = getelementptr inbounds [0 x i8], [0 x i8]* %2, i64 0, i64 0 - store i8* %3, i8** @x, align 8 - store i8* %4, i8** @y, align 8 + store ptr %1, ptr @x, align 8 + store ptr %2, ptr @y, align 8 ret void } diff --git a/llvm/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll b/llvm/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll index 0c218c713fc23..40148c857f825 100644 --- a/llvm/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll +++ b/llvm/test/Transforms/InstCombine/2012-10-25-vector-of-pointers.ll @@ -5,11 +5,10 @@ target 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" target triple = "x86_64-apple-macosx10.8.0" -%struct.hoge = type { double*, double*, double*, double** } +%struct.hoge = type { ptr, ptr, ptr, ptr } -define void @widget(%struct.hoge* nocapture %arg, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) { +define void @widget(ptr nocapture %arg, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) { bb: - %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %arg, i64 0, i32 0 br i1 %c1, label %bb1, label %bb17 bb1: ; preds = %bb @@ -19,9 +18,8 @@ bb2: ; preds = %bb1 br label %bb17 bb3: ; preds = %bb1 - %tmp4 = bitcast double** %tmp to <2 x double*>* - %tmp5 = load <2 x double*>, <2 x double*>* %tmp4, align 8 - %tmp6 = ptrtoint <2 x double*> %tmp5 to <2 x i64> + %tmp5 = load <2 x ptr>, ptr %arg, align 8 + %tmp6 = ptrtoint <2 x ptr> %tmp5 to <2 x i64> %tmp7 = sub <2 x i64> zeroinitializer, %tmp6 %tmp8 = ashr exact <2 x i64> %tmp7, %tmp9 = extractelement <2 x i64> %tmp8, i32 0 diff --git a/llvm/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll b/llvm/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll index 12b000bab6ab2..d451701be8c1f 100644 --- a/llvm/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll +++ b/llvm/test/Transforms/InstCombine/2012-12-14-simp-vgep.ll @@ -2,9 +2,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -define <4 x i32> @foo(<4 x i32*>* %in) { - %t17 = load <4 x i32*>, <4 x i32*>* %in, align 8 - %t18 = icmp eq <4 x i32*> %t17, zeroinitializer +define <4 x i32> @foo(ptr %in) { + %t17 = load <4 x ptr>, ptr %in, align 8 + %t18 = icmp eq <4 x ptr> %t17, zeroinitializer %t19 = zext <4 x i1> %t18 to <4 x i32> ret <4 x i32> %t19 } diff --git a/llvm/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll b/llvm/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll index c9542aa9c76a4..3d3cccc205291 100644 --- a/llvm/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll +++ b/llvm/test/Transforms/InstCombine/2012-3-15-or-xor-constant.ll @@ -5,8 +5,8 @@ define i32 @function(i32 %x) nounwind { entry: %xor = xor i32 %x, 1 - store volatile i32 %xor, i32* inttoptr (i64 1 to i32*), align 4 - %or4 = or i32 or (i32 zext (i1 icmp eq (i32* @g, i32* null) to i32), i32 1), %xor + store volatile i32 %xor, ptr inttoptr (i64 1 to ptr), align 4 + %or4 = or i32 or (i32 zext (i1 icmp eq (ptr @g, ptr null) to i32), i32 1), %xor ret i32 %or4 } ; CHECK-LABEL: define i32 @function( diff --git a/llvm/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll b/llvm/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll index 9c6d29d838b54..39e1c09f33031 100644 --- a/llvm/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll +++ b/llvm/test/Transforms/InstCombine/2013-03-05-Combine-BitcastTy-Into-Alloca.ll @@ -13,11 +13,11 @@ define { i64, i64 } @function(i32 %x, i32 %y, i32 %z) nounwind { ; CHECK-LABEL: @function( ; CHECK-NEXT: entry: ; CHECK-NEXT: %retval = alloca %struct._my_struct, align 8 -; CHECK-NOT: bitcast i96* %retval to %struct._my_struct* +; CHECK-NOT: bitcast ptr %retval to ptr entry: %retval = alloca %struct._my_struct, align 8 - %k.sroa.0.0.copyload = load i96, i96* bitcast (%struct._my_struct* @initval to i96*), align 1 - %k.sroa.1.12.copyload = load i32, i32* bitcast ([4 x i8]* getelementptr inbounds (%struct._my_struct, %struct._my_struct* @initval, i64 0, i32 1) to i32*), align 1 + %k.sroa.0.0.copyload = load i96, ptr @initval, align 1 + %k.sroa.1.12.copyload = load i32, ptr getelementptr inbounds (%struct._my_struct, ptr @initval, i64 0, i32 1), align 1 %0 = zext i32 %x to i96 %bf.value = shl nuw nsw i96 %0, 6 %bf.clear = and i96 %k.sroa.0.0.copyload, -288230376151711744 @@ -30,16 +30,13 @@ entry: %bf.clear4 = or i96 %bf.shl3, %bf.value.masked %bf.set5 = or i96 %bf.clear4, %bf.value8 %bf.set10 = or i96 %bf.set5, %bf.clear - %retval.0.cast7 = bitcast %struct._my_struct* %retval to i96* - store i96 %bf.set10, i96* %retval.0.cast7, align 8 - %retval.12.idx8 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 1 - %retval.12.cast9 = bitcast [4 x i8]* %retval.12.idx8 to i32* - store i32 %k.sroa.1.12.copyload, i32* %retval.12.cast9, align 4 + store i96 %bf.set10, ptr %retval, align 8 + %retval.12.idx8 = getelementptr inbounds %struct._my_struct, ptr %retval, i64 0, i32 1 + store i32 %k.sroa.1.12.copyload, ptr %retval.12.idx8, align 4 %trunc = trunc i96 %bf.set10 to i64 %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %trunc, 0 - %retval.8.idx12 = getelementptr inbounds %struct._my_struct, %struct._my_struct* %retval, i64 0, i32 0, i64 8 - %retval.8.cast13 = bitcast i8* %retval.8.idx12 to i64* - %retval.8.load14 = load i64, i64* %retval.8.cast13, align 8 + %retval.8.idx12 = getelementptr inbounds %struct._my_struct, ptr %retval, i64 0, i32 0, i64 8 + %retval.8.load14 = load i64, ptr %retval.8.idx12, align 8 %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.8.load14, 1 ret { i64, i64 } %.fca.1.insert } diff --git a/llvm/test/Transforms/InstCombine/AddOverFlow.ll b/llvm/test/Transforms/InstCombine/AddOverFlow.ll index 37c3a21f324a1..19de1ad0a5803 100644 --- a/llvm/test/Transforms/InstCombine/AddOverFlow.ll +++ b/llvm/test/Transforms/InstCombine/AddOverFlow.ll @@ -46,7 +46,7 @@ declare i32 @__gxx_personality_v0(...); !0 = !{i16 0, i16 32768} ; [0, 32767] !1 = !{i16 0, i16 32769} ; [0, 32768] -define i16 @add_bounded_values(i16 %a, i16 %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +define i16 @add_bounded_values(i16 %a, i16 %b) personality ptr @__gxx_personality_v0 { ; CHECK-LABEL: @add_bounded_values( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C:%.*]] = call i16 @bounded(i16 [[A:%.*]]), !range [[RNG0:![0-9]+]] @@ -56,8 +56,8 @@ define i16 @add_bounded_values(i16 %a, i16 %b) personality i8* bitcast (i32 (... ; CHECK-NEXT: [[E:%.*]] = add nuw i16 [[C]], [[D]] ; CHECK-NEXT: ret i16 [[E]] ; CHECK: lpad: -; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 } -; CHECK-NEXT: filter [0 x i8*] zeroinitializer +; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 } +; CHECK-NEXT: filter [0 x ptr] zeroinitializer ; CHECK-NEXT: ret i16 42 ; entry: @@ -68,12 +68,12 @@ cont: %e = add i16 %c, %d ret i16 %e lpad: - %0 = landingpad { i8*, i32 } - filter [0 x i8*] zeroinitializer + %0 = landingpad { ptr, i32 } + filter [0 x ptr] zeroinitializer ret i16 42 } -define i16 @add_bounded_values_2(i16 %a, i16 %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +define i16 @add_bounded_values_2(i16 %a, i16 %b) personality ptr @__gxx_personality_v0 { ; CHECK-LABEL: @add_bounded_values_2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C:%.*]] = call i16 @bounded(i16 [[A:%.*]]), !range [[RNG1:![0-9]+]] @@ -83,8 +83,8 @@ define i16 @add_bounded_values_2(i16 %a, i16 %b) personality i8* bitcast (i32 (. ; CHECK-NEXT: [[E:%.*]] = add i16 [[C]], [[D]] ; CHECK-NEXT: ret i16 [[E]] ; CHECK: lpad: -; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 } -; CHECK-NEXT: filter [0 x i8*] zeroinitializer +; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 } +; CHECK-NEXT: filter [0 x ptr] zeroinitializer ; CHECK-NEXT: ret i16 42 ; entry: @@ -96,8 +96,8 @@ cont: %e = add i16 %c, %d ret i16 %e lpad: - %0 = landingpad { i8*, i32 } - filter [0 x i8*] zeroinitializer + %0 = landingpad { ptr, i32 } + filter [0 x ptr] zeroinitializer ret i16 42 } diff --git a/llvm/test/Transforms/InstCombine/CPP_min_max.ll b/llvm/test/Transforms/InstCombine/CPP_min_max.ll index 28b7b2b470221..6129087580308 100644 --- a/llvm/test/Transforms/InstCombine/CPP_min_max.ll +++ b/llvm/test/Transforms/InstCombine/CPP_min_max.ll @@ -8,43 +8,43 @@ ; Instcombine should propagate the load through the select instructions to ; allow elimination of the extra stuff by the mem2reg pass. -define void @_Z5test1RiS_(i32* %x, i32* %y) { +define void @_Z5test1RiS_(ptr %x, ptr %y) { ; CHECK-LABEL: @_Z5test1RiS_( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP_1_I:%.*]] = load i32, i32* [[Y:%.*]], align 4 -; CHECK-NEXT: [[TMP_3_I:%.*]] = load i32, i32* [[X:%.*]], align 4 +; CHECK-NEXT: [[TMP_1_I:%.*]] = load i32, ptr [[Y:%.*]], align 4 +; CHECK-NEXT: [[TMP_3_I:%.*]] = load i32, ptr [[X:%.*]], align 4 ; CHECK-NEXT: [[TMP0:%.*]] = call i32 @llvm.smin.i32(i32 [[TMP_1_I]], i32 [[TMP_3_I]]) -; CHECK-NEXT: store i32 [[TMP0]], i32* [[X]], align 4 +; CHECK-NEXT: store i32 [[TMP0]], ptr [[X]], align 4 ; CHECK-NEXT: ret void ; entry: - %tmp.1.i = load i32, i32* %y ; [#uses=1] - %tmp.3.i = load i32, i32* %x ; [#uses=1] + %tmp.1.i = load i32, ptr %y ; [#uses=1] + %tmp.3.i = load i32, ptr %x ; [#uses=1] %tmp.4.i = icmp slt i32 %tmp.1.i, %tmp.3.i ; [#uses=1] - %retval.i = select i1 %tmp.4.i, i32* %y, i32* %x ; [#uses=1] - %tmp.4 = load i32, i32* %retval.i ; [#uses=1] - store i32 %tmp.4, i32* %x + %retval.i = select i1 %tmp.4.i, ptr %y, ptr %x ; [#uses=1] + %tmp.4 = load i32, ptr %retval.i ; [#uses=1] + store i32 %tmp.4, ptr %x ret void } -define void @_Z5test2RiS_(i32* %x, i32* %y) { +define void @_Z5test2RiS_(ptr %x, ptr %y) { ; CHECK-LABEL: @_Z5test2RiS_( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP_2:%.*]] = load i32, i32* [[X:%.*]], align 4 -; CHECK-NEXT: [[TMP_3_I:%.*]] = load i32, i32* [[Y:%.*]], align 4 +; CHECK-NEXT: [[TMP_2:%.*]] = load i32, ptr [[X:%.*]], align 4 +; CHECK-NEXT: [[TMP_3_I:%.*]] = load i32, ptr [[Y:%.*]], align 4 ; CHECK-NEXT: [[TMP0:%.*]] = call i32 @llvm.smax.i32(i32 [[TMP_2]], i32 [[TMP_3_I]]) -; CHECK-NEXT: store i32 [[TMP0]], i32* [[Y]], align 4 +; CHECK-NEXT: store i32 [[TMP0]], ptr [[Y]], align 4 ; CHECK-NEXT: ret void ; entry: - %tmp.0 = alloca i32 ; [#uses=2] - %tmp.2 = load i32, i32* %x ; [#uses=2] - store i32 %tmp.2, i32* %tmp.0 - %tmp.3.i = load i32, i32* %y ; [#uses=1] + %tmp.0 = alloca i32 ; [#uses=2] + %tmp.2 = load i32, ptr %x ; [#uses=2] + store i32 %tmp.2, ptr %tmp.0 + %tmp.3.i = load i32, ptr %y ; [#uses=1] %tmp.4.i = icmp slt i32 %tmp.2, %tmp.3.i ; [#uses=1] - %retval.i = select i1 %tmp.4.i, i32* %y, i32* %tmp.0 ; [#uses=1] - %tmp.6 = load i32, i32* %retval.i ; [#uses=1] - store i32 %tmp.6, i32* %y + %retval.i = select i1 %tmp.4.i, ptr %y, ptr %tmp.0 ; [#uses=1] + %tmp.6 = load i32, ptr %retval.i ; [#uses=1] + store i32 %tmp.6, ptr %y ret void } diff --git a/llvm/test/Transforms/InstCombine/InferAlignAttribute.ll b/llvm/test/Transforms/InstCombine/InferAlignAttribute.ll index fc0c1e02c86b6..d8e83b1b4af24 100644 --- a/llvm/test/Transforms/InstCombine/InferAlignAttribute.ll +++ b/llvm/test/Transforms/InstCombine/InferAlignAttribute.ll @@ -2,48 +2,48 @@ ; RUN: opt -S -inline -instcombine %s | FileCheck %s --check-prefixes=CHECK,CHECK-INLINE ; RUN: opt -S -instcombine %s | FileCheck %s --check-prefixes=CHECK,CHECK-NOINLINE -define i8* @widen_align_from_allocalign_callsite() { +define ptr @widen_align_from_allocalign_callsite() { ; CHECK-LABEL: @widen_align_from_allocalign_callsite( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call align 64 i8* @my_aligned_alloc_2(i32 noundef 320, i32 allocalign noundef 64) -; CHECK-NEXT: ret i8* [[CALL]] +; CHECK-NEXT: [[CALL:%.*]] = tail call align 64 ptr @my_aligned_alloc_2(i32 noundef 320, i32 allocalign noundef 64) +; CHECK-NEXT: ret ptr [[CALL]] ; entry: - %call = tail call align 16 i8* @my_aligned_alloc_2(i32 noundef 320, i32 allocalign noundef 64) - ret i8* %call + %call = tail call align 16 ptr @my_aligned_alloc_2(i32 noundef 320, i32 allocalign noundef 64) + ret ptr %call } -define i8* @widen_align_from_allocalign() { +define ptr @widen_align_from_allocalign() { ; CHECK-LABEL: @widen_align_from_allocalign( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call align 64 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 64) -; CHECK-NEXT: ret i8* [[CALL]] +; CHECK-NEXT: [[CALL:%.*]] = tail call align 64 ptr @my_aligned_alloc(i32 noundef 320, i32 noundef 64) +; CHECK-NEXT: ret ptr [[CALL]] ; entry: - %call = tail call align 16 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 64) - ret i8* %call + %call = tail call align 16 ptr @my_aligned_alloc(i32 noundef 320, i32 noundef 64) + ret ptr %call } -define i8* @dont_narrow_align_from_allocalign() { +define ptr @dont_narrow_align_from_allocalign() { ; CHECK-LABEL: @dont_narrow_align_from_allocalign( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CALL:%.*]] = tail call align 16 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 8) -; CHECK-NEXT: ret i8* [[CALL]] +; CHECK-NEXT: [[CALL:%.*]] = tail call align 16 ptr @my_aligned_alloc(i32 noundef 320, i32 noundef 8) +; CHECK-NEXT: ret ptr [[CALL]] ; entry: - %call = tail call align 16 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 8) - ret i8* %call + %call = tail call align 16 ptr @my_aligned_alloc(i32 noundef 320, i32 noundef 8) + ret ptr %call } -define i8* @my_aligned_alloc_3(i32 noundef %foo, i32 allocalign %alignment) { +define ptr @my_aligned_alloc_3(i32 noundef %foo, i32 allocalign %alignment) { ; CHECK-LABEL: @my_aligned_alloc_3( -; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @my_aligned_alloc_2(i32 noundef [[FOO:%.*]], i32 noundef [[ALIGNMENT:%.*]]) -; CHECK-NEXT: ret i8* [[CALL]] +; CHECK-NEXT: [[CALL:%.*]] = tail call ptr @my_aligned_alloc_2(i32 noundef [[FOO:%.*]], i32 noundef [[ALIGNMENT:%.*]]) +; CHECK-NEXT: ret ptr [[CALL]] ; - %call = tail call i8* @my_aligned_alloc_2(i32 noundef %foo, i32 noundef %alignment) - ret i8* %call + %call = tail call ptr @my_aligned_alloc_2(i32 noundef %foo, i32 noundef %alignment) + ret ptr %call } ; -inline is able to make my_aligned_alloc_3's arguments disappear and directly @@ -52,18 +52,18 @@ define i8* @my_aligned_alloc_3(i32 noundef %foo, i32 allocalign %alignment) { ; figure out the `align 128` on the return value once the call is directly on ; my_aligned_alloc_2. Note that this is a simplified version of what happens ; with _mm_malloc which calls posix_memalign. -define i8* @allocalign_disappears() { +define ptr @allocalign_disappears() { ; CHECK-INLINE-LABEL: @allocalign_disappears( -; CHECK-INLINE-NEXT: [[CALL_I:%.*]] = tail call i8* @my_aligned_alloc_2(i32 noundef 42, i32 noundef 128) -; CHECK-INLINE-NEXT: ret i8* [[CALL_I]] +; CHECK-INLINE-NEXT: [[CALL_I:%.*]] = tail call ptr @my_aligned_alloc_2(i32 noundef 42, i32 noundef 128) +; CHECK-INLINE-NEXT: ret ptr [[CALL_I]] ; ; CHECK-NOINLINE-LABEL: @allocalign_disappears( -; CHECK-NOINLINE-NEXT: [[CALL:%.*]] = tail call align 128 i8* @my_aligned_alloc_3(i32 42, i32 128) -; CHECK-NOINLINE-NEXT: ret i8* [[CALL]] +; CHECK-NOINLINE-NEXT: [[CALL:%.*]] = tail call align 128 ptr @my_aligned_alloc_3(i32 42, i32 128) +; CHECK-NOINLINE-NEXT: ret ptr [[CALL]] ; - %call = tail call i8* @my_aligned_alloc_3(i32 42, i32 128) - ret i8* %call + %call = tail call ptr @my_aligned_alloc_3(i32 42, i32 128) + ret ptr %call } -declare i8* @my_aligned_alloc(i32 noundef, i32 allocalign noundef) -declare i8* @my_aligned_alloc_2(i32 noundef, i32 noundef) +declare ptr @my_aligned_alloc(i32 noundef, i32 allocalign noundef) +declare ptr @my_aligned_alloc_2(i32 noundef, i32 noundef) diff --git a/llvm/test/Transforms/InstCombine/IntPtrCast.ll b/llvm/test/Transforms/InstCombine/IntPtrCast.ll index c3d0982c245ae..a86d7ccde8b60 100644 --- a/llvm/test/Transforms/InstCombine/IntPtrCast.ll +++ b/llvm/test/Transforms/InstCombine/IntPtrCast.ll @@ -1,10 +1,10 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s target datalayout = "e-p:32:32" -define i32* @test(i32* %P) { - %V = ptrtoint i32* %P to i32 ; [#uses=1] - %P2 = inttoptr i32 %V to i32* ; [#uses=1] - ret i32* %P2 -; CHECK: ret i32* %P +define ptr @test(ptr %P) { + %V = ptrtoint ptr %P to i32 ; [#uses=1] + %P2 = inttoptr i32 %V to ptr ; [#uses=1] + ret ptr %P2 +; CHECK: ret ptr %P } diff --git a/llvm/test/Transforms/InstCombine/LandingPadClauses.ll b/llvm/test/Transforms/InstCombine/LandingPadClauses.ll index fe437eebdeeb8..c59bd9387bb20 100644 --- a/llvm/test/Transforms/InstCombine/LandingPadClauses.ll +++ b/llvm/test/Transforms/InstCombine/LandingPadClauses.ll @@ -4,14 +4,14 @@ @T2 = external constant i32 @T3 = external constant i32 -declare i32 @generic_personality(i32, i64, i8*, i8*) -declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*) -declare i32 @__objc_personality_v0(i32, i64, i8*, i8*) +declare i32 @generic_personality(i32, i64, ptr, ptr) +declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr) +declare i32 @__objc_personality_v0(i32, i64, ptr, ptr) declare i32 @__C_specific_handler(...) declare void @bar() -define void @foo_generic() personality i32 (i32, i64, i8*, i8*)* @generic_personality { +define void @foo_generic() personality ptr @generic_personality { ; CHECK-LABEL: @foo_generic( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -43,11 +43,11 @@ cont.i: ret void lpad.a: - %a = landingpad { i8*, i32 } - catch i32* @T1 - catch i32* @T2 - catch i32* @T1 - catch i32* @T2 + %a = landingpad { ptr, i32 } + catch ptr @T1 + catch ptr @T2 + catch ptr @T1 + catch ptr @T2 unreachable ; CHECK: %a = landingpad ; CHECK-NEXT: @T1 @@ -55,86 +55,86 @@ lpad.a: ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } - filter [0 x i32*] zeroinitializer - catch i32* @T1 + %b = landingpad { ptr, i32 } + filter [0 x ptr] zeroinitializer + catch ptr @T1 unreachable ; CHECK: %b = landingpad ; CHECK-NEXT: filter ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } - catch i32* @T1 - filter [1 x i32*] [i32* @T1] - catch i32* @T2 + %c = landingpad { ptr, i32 } + catch ptr @T1 + filter [1 x ptr] [ptr @T1] + catch ptr @T2 unreachable ; Caught types should not be removed from filters ; CHECK: %c = landingpad -; CHECK-NEXT: catch i32* @T1 -; CHECK-NEXT: filter [1 x i32*] [i32* @T1] -; CHECK-NEXT: catch i32* @T2 +; CHECK-NEXT: catch ptr @T1 +; CHECK-NEXT: filter [1 x ptr] [ptr @T1] +; CHECK-NEXT: catch ptr @T2 ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } - filter [3 x i32*] zeroinitializer + %d = landingpad { ptr, i32 } + filter [3 x ptr] zeroinitializer unreachable ; CHECK: %d = landingpad -; CHECK-NEXT: filter [1 x i32*] zeroinitializer +; CHECK-NEXT: filter [1 x ptr] zeroinitializer ; CHECK-NEXT: unreachable lpad.e: - %e = landingpad { i8*, i32 } - catch i32* @T1 - filter [3 x i32*] [i32* @T1, i32* @T2, i32* @T2] + %e = landingpad { ptr, i32 } + catch ptr @T1 + filter [3 x ptr] [ptr @T1, ptr @T2, ptr @T2] unreachable ; Caught types should not be removed from filters ; CHECK: %e = landingpad -; CHECK-NEXT: catch i32* @T1 -; CHECK-NEXT: filter [2 x i32*] [i32* @T1, i32* @T2] +; CHECK-NEXT: catch ptr @T1 +; CHECK-NEXT: filter [2 x ptr] [ptr @T1, ptr @T2] ; CHECK-NEXT: unreachable lpad.f: - %f = landingpad { i8*, i32 } - filter [2 x i32*] [i32* @T2, i32* @T1] - filter [1 x i32*] [i32* @T1] + %f = landingpad { ptr, i32 } + filter [2 x ptr] [ptr @T2, ptr @T1] + filter [1 x ptr] [ptr @T1] unreachable ; CHECK: %f = landingpad -; CHECK-NEXT: filter [1 x i32*] [i32* @T1] +; CHECK-NEXT: filter [1 x ptr] [ptr @T1] ; CHECK-NEXT: unreachable lpad.g: - %g = landingpad { i8*, i32 } - filter [1 x i32*] [i32* @T1] - catch i32* @T3 - filter [2 x i32*] [i32* @T2, i32* @T1] + %g = landingpad { ptr, i32 } + filter [1 x ptr] [ptr @T1] + catch ptr @T3 + filter [2 x ptr] [ptr @T2, ptr @T1] unreachable ; CHECK: %g = landingpad -; CHECK-NEXT: filter [1 x i32*] [i32* @T1] -; CHECK-NEXT: catch i32* @T3 +; CHECK-NEXT: filter [1 x ptr] [ptr @T1] +; CHECK-NEXT: catch ptr @T3 ; CHECK-NEXT: unreachable lpad.h: - %h = landingpad { i8*, i32 } - filter [2 x i32*] [i32* @T1, i32* null] - filter [1 x i32*] zeroinitializer + %h = landingpad { ptr, i32 } + filter [2 x ptr] [ptr @T1, ptr null] + filter [1 x ptr] zeroinitializer unreachable ; CHECK: %h = landingpad -; CHECK-NEXT: filter [1 x i32*] zeroinitializer +; CHECK-NEXT: filter [1 x ptr] zeroinitializer ; CHECK-NEXT: unreachable lpad.i: - %i = landingpad { i8*, i32 } + %i = landingpad { ptr, i32 } cleanup - filter [0 x i32*] zeroinitializer + filter [0 x ptr] zeroinitializer unreachable ; CHECK: %i = landingpad ; CHECK-NEXT: filter ; CHECK-NEXT: unreachable } -define void @foo_cxx() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 { +define void @foo_cxx() personality ptr @__gxx_personality_v0 { ; CHECK-LABEL: @foo_cxx( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -151,41 +151,41 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } - catch i32* null - catch i32* @T1 + %a = landingpad { ptr, i32 } + catch ptr null + catch ptr @T1 unreachable ; CHECK: %a = landingpad ; CHECK-NEXT: null ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } - filter [1 x i32*] zeroinitializer + %b = landingpad { ptr, i32 } + filter [1 x ptr] zeroinitializer unreachable ; CHECK: %b = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } - filter [2 x i32*] [i32* @T1, i32* null] + %c = landingpad { ptr, i32 } + filter [2 x ptr] [ptr @T1, ptr null] unreachable ; CHECK: %c = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } + %d = landingpad { ptr, i32 } cleanup - catch i32* null + catch ptr null unreachable ; CHECK: %d = landingpad ; CHECK-NEXT: null ; CHECK-NEXT: unreachable } -define void @foo_objc() personality i32 (i32, i64, i8*, i8*)* @__objc_personality_v0 { +define void @foo_objc() personality ptr @__objc_personality_v0 { ; CHECK-LABEL: @foo_objc( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -202,41 +202,41 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } - catch i32* null - catch i32* @T1 + %a = landingpad { ptr, i32 } + catch ptr null + catch ptr @T1 unreachable ; CHECK: %a = landingpad ; CHECK-NEXT: null ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } - filter [1 x i32*] zeroinitializer + %b = landingpad { ptr, i32 } + filter [1 x ptr] zeroinitializer unreachable ; CHECK: %b = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } - filter [2 x i32*] [i32* @T1, i32* null] + %c = landingpad { ptr, i32 } + filter [2 x ptr] [ptr @T1, ptr null] unreachable ; CHECK: %c = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } + %d = landingpad { ptr, i32 } cleanup - catch i32* null + catch ptr null unreachable ; CHECK: %d = landingpad ; CHECK-NEXT: null ; CHECK-NEXT: unreachable } -define void @foo_seh() personality i32 (...)* @__C_specific_handler { +define void @foo_seh() personality ptr @__C_specific_handler { ; CHECK-LABEL: @foo_seh( invoke void @bar() to label %cont.a unwind label %lpad.a @@ -253,34 +253,34 @@ cont.d: ret void lpad.a: - %a = landingpad { i8*, i32 } - catch i32* null - catch i32* @T1 + %a = landingpad { ptr, i32 } + catch ptr null + catch ptr @T1 unreachable ; CHECK: %a = landingpad ; CHECK-NEXT: null ; CHECK-NEXT: unreachable lpad.b: - %b = landingpad { i8*, i32 } - filter [1 x i32*] zeroinitializer + %b = landingpad { ptr, i32 } + filter [1 x ptr] zeroinitializer unreachable ; CHECK: %b = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.c: - %c = landingpad { i8*, i32 } - filter [2 x i32*] [i32* @T1, i32* null] + %c = landingpad { ptr, i32 } + filter [2 x ptr] [ptr @T1, ptr null] unreachable ; CHECK: %c = landingpad ; CHECK-NEXT: cleanup ; CHECK-NEXT: unreachable lpad.d: - %d = landingpad { i8*, i32 } + %d = landingpad { ptr, i32 } cleanup - catch i32* null + catch ptr null unreachable ; CHECK: %d = landingpad ; CHECK-NEXT: null diff --git a/llvm/test/Transforms/InstCombine/OverlappingInsertvalues.ll b/llvm/test/Transforms/InstCombine/OverlappingInsertvalues.ll index 950cc7314f1b5..37df371717059 100644 --- a/llvm/test/Transforms/InstCombine/OverlappingInsertvalues.ll +++ b/llvm/test/Transforms/InstCombine/OverlappingInsertvalues.ll @@ -3,25 +3,25 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" ; Check that we can find and remove redundant insertvalues ; CHECK-LABEL: foo_simple -; CHECK-NOT: i8* %x, 0 -define { i8*, i64, i32 } @foo_simple(i8* %x, i8* %y) nounwind { +; CHECK-NOT: ptr %x, 0 +define { ptr, i64, i32 } @foo_simple(ptr %x, ptr %y) nounwind { entry: - %0 = insertvalue { i8*, i64, i32 } undef, i8* %x, 0 - %1 = insertvalue { i8*, i64, i32 } %0, i8* %y, 0 - ret { i8*, i64, i32 } %1 + %0 = insertvalue { ptr, i64, i32 } undef, ptr %x, 0 + %1 = insertvalue { ptr, i64, i32 } %0, ptr %y, 0 + ret { ptr, i64, i32 } %1 } ; Check that we can find and remove redundant nodes in insertvalues chain ; CHECK-LABEL: foo_ovwrt_chain ; CHECK-NOT: i64 %y, 1 ; CHECK-NOT: i32 555, 2 -define { i8*, i64, i32 } @foo_ovwrt_chain(i8* %x, i64 %y, i64 %z) nounwind { +define { ptr, i64, i32 } @foo_ovwrt_chain(ptr %x, i64 %y, i64 %z) nounwind { entry: - %0 = insertvalue { i8*, i64, i32 } undef, i8* %x, 0 - %1 = insertvalue { i8*, i64, i32 } %0, i64 %y, 1 - %2 = insertvalue { i8*, i64, i32 } %1, i32 555, 2 - %3 = insertvalue { i8*, i64, i32 } %2, i64 %z, 1 - %4 = insertvalue { i8*, i64, i32 } %3, i32 777, 2 - ret { i8*, i64, i32 } %4 + %0 = insertvalue { ptr, i64, i32 } undef, ptr %x, 0 + %1 = insertvalue { ptr, i64, i32 } %0, i64 %y, 1 + %2 = insertvalue { ptr, i64, i32 } %1, i32 555, 2 + %3 = insertvalue { ptr, i64, i32 } %2, i64 %z, 1 + %4 = insertvalue { ptr, i64, i32 } %3, i32 777, 2 + ret { ptr, i64, i32 } %4 } ; Check that we propagate insertvalues only if they are use as the first ; operand (as initial value of aggregate) diff --git a/llvm/test/Transforms/InstCombine/PR30597.ll b/llvm/test/Transforms/InstCombine/PR30597.ll index 33b3695697de7..1e463e396551b 100644 --- a/llvm/test/Transforms/InstCombine/PR30597.ll +++ b/llvm/test/Transforms/InstCombine/PR30597.ll @@ -5,32 +5,32 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: readonly uwtable -define i1 @dot_ref_s(i32** noalias nocapture readonly dereferenceable(8)) { +define i1 @dot_ref_s(ptr noalias nocapture readonly dereferenceable(8)) { ; CHECK-LABEL: @dot_ref_s( ; CHECK-NEXT: entry-block: ; CHECK-NEXT: ret i1 false ; entry-block: - %loadedptr = load i32*, i32** %0, align 8, !nonnull !0 - %ptrtoint = ptrtoint i32* %loadedptr to i64 - %inttoptr = inttoptr i64 %ptrtoint to i32* - %switchtmp = icmp eq i32* %inttoptr, null + %loadedptr = load ptr, ptr %0, align 8, !nonnull !0 + %ptrtoint = ptrtoint ptr %loadedptr to i64 + %inttoptr = inttoptr i64 %ptrtoint to ptr + %switchtmp = icmp eq ptr %inttoptr, null ret i1 %switchtmp } ; Function Attrs: readonly uwtable -define i64* @function(i64* noalias nocapture readonly dereferenceable(8)) { +define ptr @function(ptr noalias nocapture readonly dereferenceable(8)) { ; CHECK-LABEL: @function( ; CHECK-NEXT: entry-block: -; CHECK-NEXT: [[LOADED:%.*]] = load i64, i64* [[TMP0:%.*]], align 8, !range [[RNG0:![0-9]+]] -; CHECK-NEXT: [[INTTOPTR:%.*]] = inttoptr i64 [[LOADED]] to i64* -; CHECK-NEXT: ret i64* [[INTTOPTR]] +; CHECK-NEXT: [[LOADED:%.*]] = load i64, ptr [[TMP0:%.*]], align 8, !range [[RNG0:![0-9]+]] +; CHECK-NEXT: [[INTTOPTR:%.*]] = inttoptr i64 [[LOADED]] to ptr +; CHECK-NEXT: ret ptr [[INTTOPTR]] ; entry-block: - %loaded = load i64, i64* %0, align 8, !range !1 - %inttoptr = inttoptr i64 %loaded to i64* - ret i64* %inttoptr + %loaded = load i64, ptr %0, align 8, !range !1 + %inttoptr = inttoptr i64 %loaded to ptr + ret ptr %inttoptr } diff --git a/llvm/test/Transforms/InstCombine/PR37526.ll b/llvm/test/Transforms/InstCombine/PR37526.ll index 25812c0751da3..e2ef0261296f4 100644 --- a/llvm/test/Transforms/InstCombine/PR37526.ll +++ b/llvm/test/Transforms/InstCombine/PR37526.ll @@ -1,25 +1,21 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -instcombine -S < %s | FileCheck %s -define void @PR37526(i32* %pz, i32* %px, i32* %py) { +define void @PR37526(ptr %pz, ptr %px, ptr %py) { ; CHECK-LABEL: @PR37526( -; CHECK-NEXT: [[T1:%.*]] = bitcast i32* [[PZ:%.*]] to i64* -; CHECK-NEXT: [[T2:%.*]] = load i32, i32* [[PY:%.*]], align 4 -; CHECK-NEXT: [[T3:%.*]] = load i32, i32* [[PX:%.*]], align 4 +; CHECK-NEXT: [[T2:%.*]] = load i32, ptr [[PY:%.*]], align 4 +; CHECK-NEXT: [[T3:%.*]] = load i32, ptr [[PX:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[T2]], [[T3]] -; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], i32* [[PX]], i32* [[PY]] -; CHECK-NEXT: [[BC:%.*]] = bitcast i32* [[SELECT]] to i64* -; CHECK-NEXT: [[R:%.*]] = load i64, i64* [[BC]], align 4 -; CHECK-NEXT: store i64 [[R]], i64* [[T1]], align 4 +; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], ptr [[PX]], ptr [[PY]] +; CHECK-NEXT: [[R:%.*]] = load i64, ptr [[SELECT]], align 4 +; CHECK-NEXT: store i64 [[R]], ptr [[PZ:%.*]], align 4 ; CHECK-NEXT: ret void ; - %t1 = bitcast i32* %pz to i64* - %t2 = load i32, i32* %py - %t3 = load i32, i32* %px + %t2 = load i32, ptr %py + %t3 = load i32, ptr %px %cmp = icmp slt i32 %t2, %t3 - %select = select i1 %cmp, i32* %px, i32* %py - %bc = bitcast i32* %select to i64* - %r = load i64, i64* %bc - store i64 %r, i64* %t1 + %select = select i1 %cmp, ptr %px, ptr %py + %r = load i64, ptr %select + store i64 %r, ptr %pz ret void } diff --git a/llvm/test/Transforms/InstCombine/abs-1.ll b/llvm/test/Transforms/InstCombine/abs-1.ll index 245b87e65af8a..039a844959a29 100644 --- a/llvm/test/Transforms/InstCombine/abs-1.ll +++ b/llvm/test/Transforms/InstCombine/abs-1.ll @@ -576,11 +576,11 @@ define i8 @nabs_different_constants(i8 %a) { define i64 @infinite_loop_constant_expression_abs(i64 %arg) { ; CHECK-LABEL: @infinite_loop_constant_expression_abs( -; CHECK-NEXT: [[T:%.*]] = sub i64 ptrtoint (i64* @g to i64), [[ARG:%.*]] +; CHECK-NEXT: [[T:%.*]] = sub i64 ptrtoint (ptr @g to i64), [[ARG:%.*]] ; CHECK-NEXT: [[TMP1:%.*]] = call i64 @llvm.abs.i64(i64 [[T]], i1 true) ; CHECK-NEXT: ret i64 [[TMP1]] ; - %t = sub i64 ptrtoint (i64* @g to i64), %arg + %t = sub i64 ptrtoint (ptr @g to i64), %arg %t1 = icmp slt i64 %t, 0 %t2 = sub nsw i64 0, %t %t3 = select i1 %t1, i64 %t2, i64 %t diff --git a/llvm/test/Transforms/InstCombine/abs-intrinsic.ll b/llvm/test/Transforms/InstCombine/abs-intrinsic.ll index 92d2750d2bc16..ebaf8664c45d7 100644 --- a/llvm/test/Transforms/InstCombine/abs-intrinsic.ll +++ b/llvm/test/Transforms/InstCombine/abs-intrinsic.ll @@ -315,15 +315,15 @@ define <3 x i82> @abs_nsw_sext(<3 x i7> %x) { ret <3 x i82> %a } -define i32 @abs_sext_extra_use(i8 %x, i32* %p) { +define i32 @abs_sext_extra_use(i8 %x, ptr %p) { ; CHECK-LABEL: @abs_sext_extra_use( ; CHECK-NEXT: [[S:%.*]] = sext i8 [[X:%.*]] to i32 -; CHECK-NEXT: store i32 [[S]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[S]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[A:%.*]] = call i32 @llvm.abs.i32(i32 [[S]], i1 false) ; CHECK-NEXT: ret i32 [[A]] ; %s = sext i8 %x to i32 - store i32 %s, i32* %p + store i32 %s, ptr %p %a = call i32 @llvm.abs.i32(i32 %s, i1 0) ret i32 %a } @@ -399,15 +399,15 @@ define i32 @srem_by_2_int_min_is_poison(i32 %x) { ret i32 %r } -define <3 x i82> @srem_by_2(<3 x i82> %x, <3 x i82>* %p) { +define <3 x i82> @srem_by_2(<3 x i82> %x, ptr %p) { ; CHECK-LABEL: @srem_by_2( ; CHECK-NEXT: [[S:%.*]] = srem <3 x i82> [[X:%.*]], -; CHECK-NEXT: store <3 x i82> [[S]], <3 x i82>* [[P:%.*]], align 32 +; CHECK-NEXT: store <3 x i82> [[S]], ptr [[P:%.*]], align 32 ; CHECK-NEXT: [[R:%.*]] = and <3 x i82> [[X]], ; CHECK-NEXT: ret <3 x i82> [[R]] ; %s = srem <3 x i82> %x, - store <3 x i82> %s, <3 x i82>* %p + store <3 x i82> %s, ptr %p %r = call <3 x i82> @llvm.abs.v3i82(<3 x i82> %s, i1 false) ret <3 x i82> %r } diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll index eb855f515340d..ccb18f9354114 100644 --- a/llvm/test/Transforms/InstCombine/add.ll +++ b/llvm/test/Transforms/InstCombine/add.ll @@ -455,31 +455,31 @@ define i32 @add_nsw_sext_add(i8 %x) { ; Negative test - extra use of the sext means increase of instructions. -define i32 @add_nsw_sext_add_extra_use_1(i8 %x, i32* %p) { +define i32 @add_nsw_sext_add_extra_use_1(i8 %x, ptr %p) { ; CHECK-LABEL: @add_nsw_sext_add_extra_use_1( ; CHECK-NEXT: [[ADD:%.*]] = add nsw i8 [[X:%.*]], 42 ; CHECK-NEXT: [[EXT:%.*]] = sext i8 [[ADD]] to i32 -; CHECK-NEXT: store i32 [[EXT]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[EXT]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[R:%.*]] = add nsw i32 [[EXT]], 356 ; CHECK-NEXT: ret i32 [[R]] ; %add = add nsw i8 %x, 42 %ext = sext i8 %add to i32 - store i32 %ext, i32* %p + store i32 %ext, ptr %p %r = add i32 %ext, 356 ret i32 %r } -define <2 x i32> @add_nsw_sext_add_vec_extra_use_2(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i32> @add_nsw_sext_add_vec_extra_use_2(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @add_nsw_sext_add_vec_extra_use_2( ; CHECK-NEXT: [[ADD:%.*]] = add nsw <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[ADD]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[ADD]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[TMP1:%.*]] = sext <2 x i8> [[X]] to <2 x i32> ; CHECK-NEXT: [[R:%.*]] = add nsw <2 x i32> [[TMP1]], ; CHECK-NEXT: ret <2 x i32> [[R]] ; %add = add nsw <2 x i8> %x, - store <2 x i8> %add, <2 x i8>* %p + store <2 x i8> %add, ptr %p %ext = sext <2 x i8> %add to <2 x i32> %r = add <2 x i32> %ext, ret <2 x i32> %r @@ -499,31 +499,31 @@ define <2 x i32> @add_nuw_zext_add_vec(<2 x i16> %x) { ; Negative test - extra use of the zext means increase of instructions. -define i64 @add_nuw_zext_add_extra_use_1(i8 %x, i64* %p) { +define i64 @add_nuw_zext_add_extra_use_1(i8 %x, ptr %p) { ; CHECK-LABEL: @add_nuw_zext_add_extra_use_1( ; CHECK-NEXT: [[ADD:%.*]] = add nuw i8 [[X:%.*]], 42 ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[ADD]] to i64 -; CHECK-NEXT: store i64 [[EXT]], i64* [[P:%.*]], align 4 +; CHECK-NEXT: store i64 [[EXT]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[R:%.*]] = add nuw nsw i64 [[EXT]], 356 ; CHECK-NEXT: ret i64 [[R]] ; %add = add nuw i8 %x, 42 %ext = zext i8 %add to i64 - store i64 %ext, i64* %p + store i64 %ext, ptr %p %r = add i64 %ext, 356 ret i64 %r } -define i64 @add_nuw_zext_add_extra_use_2(i8 %x, i8* %p) { +define i64 @add_nuw_zext_add_extra_use_2(i8 %x, ptr %p) { ; CHECK-LABEL: @add_nuw_zext_add_extra_use_2( ; CHECK-NEXT: [[ADD:%.*]] = add nuw i8 [[X:%.*]], 42 -; CHECK-NEXT: store i8 [[ADD]], i8* [[P:%.*]], align 1 +; CHECK-NEXT: store i8 [[ADD]], ptr [[P:%.*]], align 1 ; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[X]] to i64 ; CHECK-NEXT: [[R:%.*]] = add nuw nsw i64 [[TMP1]], -314 ; CHECK-NEXT: ret i64 [[R]] ; %add = add nuw i8 %x, 42 - store i8 %add, i8* %p + store i8 %add, ptr %p %ext = zext i8 %add to i64 %r = add i64 %ext, -356 ret i64 %r @@ -1206,17 +1206,17 @@ define i32 @and31_add(i1 %x, i1 %y) { ; Negative test - extra use -define i32 @lshr_add_use(i1 %x, i1 %y, i32* %p) { +define i32 @lshr_add_use(i1 %x, i1 %y, ptr %p) { ; CHECK-LABEL: @lshr_add_use( ; CHECK-NEXT: [[XZ:%.*]] = zext i1 [[X:%.*]] to i32 -; CHECK-NEXT: store i32 [[XZ]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[XZ]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32 ; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XZ]], [[YS]] ; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[R]] ; %xz = zext i1 %x to i32 - store i32 %xz, i32* %p + store i32 %xz, ptr %p %ys = sext i1 %y to i32 %sub = add i32 %xz, %ys %r = lshr i32 %sub, 31 @@ -1225,18 +1225,18 @@ define i32 @lshr_add_use(i1 %x, i1 %y, i32* %p) { ; Negative test - extra use -define i32 @lshr_add_use2(i1 %x, i1 %y, i32* %p) { +define i32 @lshr_add_use2(i1 %x, i1 %y, ptr %p) { ; CHECK-LABEL: @lshr_add_use2( ; CHECK-NEXT: [[XZ:%.*]] = zext i1 [[X:%.*]] to i32 ; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32 -; CHECK-NEXT: store i32 [[YS]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[YS]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XZ]], [[YS]] ; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[R]] ; %xz = zext i1 %x to i32 %ys = sext i1 %y to i32 - store i32 %ys, i32* %p + store i32 %ys, ptr %p %sub = add i32 %xz, %ys %r = lshr i32 %sub, 31 ret i32 %r @@ -1332,17 +1332,17 @@ define i32 @and31_add_sexts(i1 %x, i1 %y) { ; Negative test - extra use -define i32 @lshr_add_use_sexts(i1 %x, i1 %y, i32* %p) { +define i32 @lshr_add_use_sexts(i1 %x, i1 %y, ptr %p) { ; CHECK-LABEL: @lshr_add_use_sexts( ; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32 -; CHECK-NEXT: store i32 [[XS]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[XS]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32 ; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]] ; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[R]] ; %xs = sext i1 %x to i32 - store i32 %xs, i32* %p + store i32 %xs, ptr %p %ys = sext i1 %y to i32 %sub = add i32 %xs, %ys %r = lshr i32 %sub, 31 @@ -1351,18 +1351,18 @@ define i32 @lshr_add_use_sexts(i1 %x, i1 %y, i32* %p) { ; Negative test - extra use -define i32 @lshr_add_use2_sexts(i1 %x, i1 %y, i32* %p) { +define i32 @lshr_add_use2_sexts(i1 %x, i1 %y, ptr %p) { ; CHECK-LABEL: @lshr_add_use2_sexts( ; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32 ; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32 -; CHECK-NEXT: store i32 [[YS]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[YS]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]] ; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[R]] ; %xs = sext i1 %x to i32 %ys = sext i1 %y to i32 - store i32 %ys, i32* %p + store i32 %ys, ptr %p %sub = add i32 %xs, %ys %r = lshr i32 %sub, 31 ret i32 %r diff --git a/llvm/test/Transforms/InstCombine/add3.ll b/llvm/test/Transforms/InstCombine/add3.ll index 5395dfa1b9bc8..7580a1ba003c7 100644 --- a/llvm/test/Transforms/InstCombine/add3.ll +++ b/llvm/test/Transforms/InstCombine/add3.ll @@ -8,12 +8,12 @@ target triple = "i686-apple-darwin8" define void @test2(i32 %.val24) { EntryBlock: add i32 %.val24, -12 - inttoptr i32 %0 to i32* - store i32 1, i32* %1 + inttoptr i32 %0 to ptr + store i32 1, ptr %1 add i32 %.val24, -16 - inttoptr i32 %2 to i32* - getelementptr i32, i32* %3, i32 1 - load i32, i32* %4 + inttoptr i32 %2 to ptr + getelementptr i32, ptr %3, i32 1 + load i32, ptr %4 tail call i32 @callee( i32 %5 ) ret void } diff --git a/llvm/test/Transforms/InstCombine/align-2d-gep.ll b/llvm/test/Transforms/InstCombine/align-2d-gep.ll index cd2ae85b300ac..a2606fba2bf83 100644 --- a/llvm/test/Transforms/InstCombine/align-2d-gep.ll +++ b/llvm/test/Transforms/InstCombine/align-2d-gep.ll @@ -21,12 +21,10 @@ define void @foo() nounwind { ; CHECK-NEXT: br label [[BB1:%.*]] ; CHECK: bb1: ; CHECK-NEXT: [[J:%.*]] = phi i64 [ 0, [[BB7_OUTER]] ], [ [[INDVAR_NEXT:%.*]], [[BB1]] ] -; CHECK-NEXT: [[T4:%.*]] = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 [[I]], i64 [[J]] -; CHECK-NEXT: [[Q:%.*]] = bitcast double* [[T4]] to <2 x double>* -; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[Q]], align 16 -; CHECK-NEXT: [[S4:%.*]] = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 [[I]], i64 [[J]] -; CHECK-NEXT: [[R:%.*]] = bitcast double* [[S4]] to <2 x double>* -; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[R]], align 8 +; CHECK-NEXT: [[T4:%.*]] = getelementptr [1001 x [20000 x double]], ptr @Nice, i64 0, i64 [[I]], i64 [[J]] +; CHECK-NEXT: store <2 x double> zeroinitializer, ptr [[T4]], align 16 +; CHECK-NEXT: [[S4:%.*]] = getelementptr [1001 x [20001 x double]], ptr @Awkward, i64 0, i64 [[I]], i64 [[J]] +; CHECK-NEXT: store <2 x double> zeroinitializer, ptr [[S4]], align 8 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[J]], 2 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], 556 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[BB11]], label [[BB1]] @@ -47,13 +45,11 @@ bb7.outer: bb1: %j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ] - %t4 = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j - %q = bitcast double* %t4 to <2 x double>* - store <2 x double>, <2 x double>* %q, align 8 + %t4 = getelementptr [1001 x [20000 x double]], ptr @Nice, i64 0, i64 %i, i64 %j + store <2 x double>, ptr %t4, align 8 - %s4 = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j - %r = bitcast double* %s4 to <2 x double>* - store <2 x double>, <2 x double>* %r, align 8 + %s4 = getelementptr [1001 x [20001 x double]], ptr @Awkward, i64 0, i64 %i, i64 %j + store <2 x double>, ptr %s4, align 8 %indvar.next = add i64 %j, 2 %exitcond = icmp eq i64 %indvar.next, 556 diff --git a/llvm/test/Transforms/InstCombine/align-addr.ll b/llvm/test/Transforms/InstCombine/align-addr.ll index abc52f2adc3b8..a53da0bc5a20a 100644 --- a/llvm/test/Transforms/InstCombine/align-addr.ll +++ b/llvm/test/Transforms/InstCombine/align-addr.ll @@ -5,12 +5,12 @@ target datalayout = "E-p:64:64:64-p1:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8- ; Instcombine should be able to prove vector alignment in the ; presence of a few mild address computation tricks. -define void @test0(i8* %b, i64 %n, i64 %u, i64 %y) nounwind { +define void @test0(ptr %b, i64 %n, i64 %u, i64 %y) nounwind { ; CHECK-LABEL: @test0( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[C:%.*]] = ptrtoint i8* [[B:%.*]] to i64 +; CHECK-NEXT: [[C:%.*]] = ptrtoint ptr [[B:%.*]] to i64 ; CHECK-NEXT: [[D:%.*]] = and i64 [[C]], -16 -; CHECK-NEXT: [[E:%.*]] = inttoptr i64 [[D]] to double* +; CHECK-NEXT: [[E:%.*]] = inttoptr i64 [[D]] to ptr ; CHECK-NEXT: [[V:%.*]] = shl i64 [[U:%.*]], 1 ; CHECK-NEXT: [[Z:%.*]] = and i64 [[Y:%.*]], -2 ; CHECK-NEXT: [[T1421:%.*]] = icmp eq i64 [[N:%.*]], 0 @@ -19,9 +19,8 @@ define void @test0(i8* %b, i64 %n, i64 %u, i64 %y) nounwind { ; CHECK-NEXT: [[I:%.*]] = phi i64 [ [[INDVAR_NEXT:%.*]], [[BB]] ], [ 20, [[ENTRY:%.*]] ] ; CHECK-NEXT: [[J:%.*]] = mul i64 [[I]], [[V]] ; CHECK-NEXT: [[H:%.*]] = add i64 [[J]], [[Z]] -; CHECK-NEXT: [[T8:%.*]] = getelementptr double, double* [[E]], i64 [[H]] -; CHECK-NEXT: [[P:%.*]] = bitcast double* [[T8]] to <2 x double>* -; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[P]], align 16 +; CHECK-NEXT: [[T8:%.*]] = getelementptr double, ptr [[E]], i64 [[H]] +; CHECK-NEXT: store <2 x double> zeroinitializer, ptr [[T8]], align 16 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[I]], 1 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], [[N]] ; CHECK-NEXT: br i1 [[EXITCOND]], label [[RETURN]], label [[BB]] @@ -29,9 +28,9 @@ define void @test0(i8* %b, i64 %n, i64 %u, i64 %y) nounwind { ; CHECK-NEXT: ret void ; entry: - %c = ptrtoint i8* %b to i64 + %c = ptrtoint ptr %b to i64 %d = and i64 %c, -16 - %e = inttoptr i64 %d to double* + %e = inttoptr i64 %d to ptr %v = mul i64 %u, 2 %z = and i64 %y, -2 %t1421 = icmp eq i64 %n, 0 @@ -41,9 +40,8 @@ bb: %i = phi i64 [ %indvar.next, %bb ], [ 20, %entry ] %j = mul i64 %i, %v %h = add i64 %j, %z - %t8 = getelementptr double, double* %e, i64 %h - %p = bitcast double* %t8 to <2 x double>* - store <2 x double>, <2 x double>* %p, align 8 + %t8 = getelementptr double, ptr %e, i64 %h + store <2 x double>, ptr %t8, align 8 %indvar.next = add i64 %i, 1 %exitcond = icmp eq i64 %indvar.next, %n br i1 %exitcond, label %return, label %bb @@ -60,11 +58,11 @@ return: define <16 x i8> @test1(<2 x i64> %x) { ; CHECK-LABEL: @test1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 16 +; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, ptr @GLOBAL, align 16 ; CHECK-NEXT: ret <16 x i8> [[TMP]] ; entry: - %tmp = load <16 x i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1 + %tmp = load <16 x i8>, ptr @GLOBAL, align 1 ret <16 x i8> %tmp } @@ -72,10 +70,10 @@ entry: define <16 x i8> @test1_as1(<2 x i64> %x) { ; CHECK-LABEL: @test1_as1( -; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, <16 x i8> addrspace(1)* bitcast ([4 x i32] addrspace(1)* @GLOBAL_as1 to <16 x i8> addrspace(1)*), align 16 +; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, ptr addrspace(1) @GLOBAL_as1, align 16 ; CHECK-NEXT: ret <16 x i8> [[TMP]] ; - %tmp = load <16 x i8>, <16 x i8> addrspace(1)* bitcast ([4 x i32] addrspace(1)* @GLOBAL_as1 to <16 x i8> addrspace(1)*), align 1 + %tmp = load <16 x i8>, ptr addrspace(1) @GLOBAL_as1, align 1 ret <16 x i8> %tmp } @@ -83,43 +81,41 @@ define <16 x i8> @test1_as1(<2 x i64> %x) { define <16 x i8> @test1_as1_gep(<2 x i64> %x) { ; CHECK-LABEL: @test1_as1_gep( -; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, <16 x i8> addrspace(1)* bitcast (i32 addrspace(1)* getelementptr inbounds ([8 x i32], [8 x i32] addrspace(1)* @GLOBAL_as1_gep, i32 0, i32 4) to <16 x i8> addrspace(1)*), align 16 +; CHECK-NEXT: [[TMP:%.*]] = load <16 x i8>, ptr addrspace(1) getelementptr inbounds ([8 x i32], ptr addrspace(1) @GLOBAL_as1_gep, i32 0, i32 4), align 16 ; CHECK-NEXT: ret <16 x i8> [[TMP]] ; - %tmp = load <16 x i8>, <16 x i8> addrspace(1)* bitcast (i32 addrspace(1)* getelementptr ([8 x i32], [8 x i32] addrspace(1)* @GLOBAL_as1_gep, i16 0, i16 4) to <16 x i8> addrspace(1)*), align 1 + %tmp = load <16 x i8>, ptr addrspace(1) getelementptr ([8 x i32], ptr addrspace(1) @GLOBAL_as1_gep, i16 0, i16 4), align 1 ret <16 x i8> %tmp } ; When a load or store lacks an explicit alignment, add one. -define double @test2(double* %p, double %n) nounwind { +define double @test2(ptr %p, double %n) nounwind { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[T:%.*]] = load double, double* [[P:%.*]], align 8 -; CHECK-NEXT: store double [[N:%.*]], double* [[P]], align 8 +; CHECK-NEXT: [[T:%.*]] = load double, ptr [[P:%.*]], align 8 +; CHECK-NEXT: store double [[N:%.*]], ptr [[P]], align 8 ; CHECK-NEXT: ret double [[T]] ; - %t = load double, double* %p - store double %n, double* %p + %t = load double, ptr %p + store double %n, ptr %p ret double %t } -declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind +declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind -declare void @use(i8*) +declare void @use(ptr) %struct.s = type { i32, i32, i32, i32 } -define void @test3(%struct.s* sret(%struct.s) %a4) { +define void @test3(ptr sret(%struct.s) %a4) { ; Check that the alignment is bumped up the alignment of the sret type. ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[A4_CAST:%.*]] = bitcast %struct.s* [[A4:%.*]] to i8* -; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* noundef nonnull align 4 dereferenceable(16) [[A4_CAST]], i8 0, i64 16, i1 false) -; CHECK-NEXT: call void @use(i8* [[A4_CAST]]) +; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) [[A4:%.*]], i8 0, i64 16, i1 false) +; CHECK-NEXT: call void @use(ptr [[A4:%.*]]) ; CHECK-NEXT: ret void ; - %a4.cast = bitcast %struct.s* %a4 to i8* - call void @llvm.memset.p0i8.i64(i8* %a4.cast, i8 0, i64 16, i1 false) - call void @use(i8* %a4.cast) + call void @llvm.memset.p0.i64(ptr %a4, i8 0, i64 16, i1 false) + call void @use(ptr %a4) ret void } diff --git a/llvm/test/Transforms/InstCombine/align-attr.ll b/llvm/test/Transforms/InstCombine/align-attr.ll index 1e8f580ce6275..687aa604a4438 100644 --- a/llvm/test/Transforms/InstCombine/align-attr.ll +++ b/llvm/test/Transforms/InstCombine/align-attr.ll @@ -4,31 +4,31 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind uwtable -define i32 @foo1(i32* align 32 %a) #0 { +define i32 @foo1(ptr align 32 %a) #0 { ; CHECK-LABEL: @foo1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[A:%.*]], align 32 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 32 ; CHECK-NEXT: ret i32 [[TMP0]] ; entry: - %0 = load i32, i32* %a, align 4 + %0 = load i32, ptr %a, align 4 ret i32 %0 } -define i32 @foo2(i32* align 32 %a) #0 { +define i32 @foo2(ptr align 32 %a) #0 { ; CHECK-LABEL: @foo2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[V:%.*]] = call i32* @func1(i32* [[A:%.*]]) -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[A]], align 32 +; CHECK-NEXT: [[V:%.*]] = call ptr @func1(ptr [[A:%.*]]) +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 32 ; CHECK-NEXT: ret i32 [[TMP0]] ; entry: - %v = call i32* @func1(i32* %a) - %0 = load i32, i32* %v, align 4 + %v = call ptr @func1(ptr %a) + %0 = load i32, ptr %v, align 4 ret i32 %0 } -declare i32* @func1(i32* returned) nounwind +declare ptr @func1(ptr returned) nounwind diff --git a/llvm/test/Transforms/InstCombine/align-external.ll b/llvm/test/Transforms/InstCombine/align-external.ll index 0e83e3692e249..68853cbd6e1c4 100644 --- a/llvm/test/Transforms/InstCombine/align-external.ll +++ b/llvm/test/Transforms/InstCombine/align-external.ll @@ -12,7 +12,7 @@ target datalayout = "i32:8:32" ; CHECK: @C = available_externally global <4 x i32> zeroinitializer, align 4 define i64 @foo(i64 %a) { - %t = ptrtoint i32* @A to i64 + %t = ptrtoint ptr @A to i64 %s = shl i64 %a, 3 %r = or i64 %t, %s %q = add i64 %r, 1 @@ -21,12 +21,12 @@ define i64 @foo(i64 %a) { ; CHECK-LABEL: define i64 @foo(i64 %a) ; CHECK: %s = shl i64 %a, 3 -; CHECK: %r = or i64 %s, ptrtoint (i32* @A to i64) +; CHECK: %r = or i64 %s, ptrtoint (ptr @A to i64) ; CHECK: %q = add i64 %r, 1 ; CHECK: ret i64 %q define i32 @bar() { - %r = load i32, i32* @B, align 1 + %r = load i32, ptr @B, align 1 ret i32 %r } @@ -34,8 +34,8 @@ define i32 @bar() { ; CHECK: align 1 define void @vec_store() { - store <4 x i32> , <4 x i32>* @C, align 4 + store <4 x i32> , ptr @C, align 4 ret void } ; CHECK: define void @vec_store() -; CHECK: store <4 x i32> , <4 x i32>* @C, align 4 +; CHECK: store <4 x i32> , ptr @C, align 4 diff --git a/llvm/test/Transforms/InstCombine/all-bits-shift.ll b/llvm/test/Transforms/InstCombine/all-bits-shift.ll index 83ad7c039dc3e..77a3500d397f2 100644 --- a/llvm/test/Transforms/InstCombine/all-bits-shift.ll +++ b/llvm/test/Transforms/InstCombine/all-bits-shift.ll @@ -4,7 +4,7 @@ target datalayout = "E-m:e-i64:64-n32:64" target triple = "powerpc64-unknown-linux-gnu" @d = global i32 15, align 4 -@b = global i32* @d, align 8 +@b = global ptr @d, align 8 @a = common global i32 0, align 4 ; Check that both InstCombine and InstSimplify can use computeKnownBits to @@ -14,29 +14,29 @@ target triple = "powerpc64-unknown-linux-gnu" define signext i32 @main() #1 { ; CHECK-LABEL: @main( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32*, i32** @b, align 8 -; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr @b, align 8 +; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4 ; CHECK-NEXT: ret i32 [[TMP1]] ; entry: - %0 = load i32*, i32** @b, align 8 - %1 = load i32, i32* @a, align 4 + %0 = load ptr, ptr @b, align 8 + %1 = load i32, ptr @a, align 4 %lnot = icmp eq i32 %1, 0 %lnot.ext = zext i1 %lnot to i32 %shr.i = lshr i32 2072, %lnot.ext %call.lobit = lshr i32 %shr.i, 7 %2 = and i32 %call.lobit, 1 - %3 = load i32, i32* %0, align 4 + %3 = load i32, ptr %0, align 4 %or = or i32 %2, %3 - store i32 %or, i32* %0, align 4 - %4 = load i32, i32* @a, align 4 + store i32 %or, ptr %0, align 4 + %4 = load i32, ptr @a, align 4 %lnot.1 = icmp eq i32 %4, 0 %lnot.ext.1 = zext i1 %lnot.1 to i32 %shr.i.1 = lshr i32 2072, %lnot.ext.1 %call.lobit.1 = lshr i32 %shr.i.1, 7 %5 = and i32 %call.lobit.1, 1 %or.1 = or i32 %5, %or - store i32 %or.1, i32* %0, align 4 + store i32 %or.1, ptr %0, align 4 ret i32 %or.1 } diff --git a/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll b/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll index 2031a2934925f..8b5bc7e034d33 100644 --- a/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll +++ b/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll @@ -5,15 +5,15 @@ define dso_local void @test() local_unnamed_addr #0 { ; CHECK-LABEL: @test( ; CHECK-NEXT: ret void ; - %1 = tail call noalias align 16 dereferenceable_or_null(4) i8* @malloc(i64 4) #4 - %2 = tail call align 16 dereferenceable_or_null(6) i8* @realloc(i8* %1, i64 6) #4 - tail call void @free(i8* %2) #4 + %1 = tail call noalias align 16 dereferenceable_or_null(4) ptr @malloc(i64 4) #4 + %2 = tail call align 16 dereferenceable_or_null(6) ptr @realloc(ptr %1, i64 6) #4 + tail call void @free(ptr %2) #4 ret void } -declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr #1 -declare dso_local noalias noundef i8* @realloc(i8* nocapture allocptr, i64 noundef) local_unnamed_addr #2 -declare dso_local void @free(i8* nocapture allocptr noundef) local_unnamed_addr #3 +declare dso_local noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1 +declare dso_local noalias noundef ptr @realloc(ptr nocapture allocptr, i64 noundef) local_unnamed_addr #2 +declare dso_local void @free(ptr nocapture allocptr noundef) local_unnamed_addr #3 declare void @llvm.dbg.value(metadata, metadata, metadata) #3 attributes #0 = { mustprogress nounwind uwtable willreturn } diff --git a/llvm/test/Transforms/InstCombine/alloca-big.ll b/llvm/test/Transforms/InstCombine/alloca-big.ll index 27e76e752fcee..6925f1ba988dc 100644 --- a/llvm/test/Transforms/InstCombine/alloca-big.ll +++ b/llvm/test/Transforms/InstCombine/alloca-big.ll @@ -2,15 +2,13 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5223 -define void @test_bigalloc(i8** %dst) { +define void @test_bigalloc(ptr %dst) { ; CHECK-LABEL: @test_bigalloc( ; CHECK-NEXT: [[TMP1:%.*]] = alloca [18446744069414584320 x i8], align 1 -; CHECK-NEXT: [[DOTSUB:%.*]] = getelementptr inbounds [18446744069414584320 x i8], [18446744069414584320 x i8]* [[TMP1]], i64 0, i64 0 -; CHECK-NEXT: store i8* [[DOTSUB]], i8** [[DST:%.*]], align 8 +; CHECK-NEXT: store ptr [[TMP1]], ptr [[DST:%.*]], align 8 ; CHECK-NEXT: ret void ; %1 = alloca i8, i864 -4294967296 - %2 = getelementptr i8, i8* %1, i1 0 - store i8* %2, i8** %dst + store ptr %1, ptr %dst ret void } diff --git a/llvm/test/Transforms/InstCombine/allocsize-32.ll b/llvm/test/Transforms/InstCombine/allocsize-32.ll index 5b96a9b2d73bd..589561dfbc4a5 100644 --- a/llvm/test/Transforms/InstCombine/allocsize-32.ll +++ b/llvm/test/Transforms/InstCombine/allocsize-32.ll @@ -6,24 +6,24 @@ target datalayout="e-p:32:32:32" -declare i8* @my_malloc(i8*, i64) allocsize(1) +declare ptr @my_malloc(ptr, i64) allocsize(1) -define void @test_malloc(i8** %p, i32* %r) { - %1 = call i8* @my_malloc(i8* null, i64 100) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_malloc(ptr %p, ptr %r) { + %1 = call ptr @my_malloc(ptr null, i64 100) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %1, i1 false) + %2 = call i32 @llvm.objectsize.i32.p0(ptr %1, i1 false) ; CHECK: store i32 100 - store i32 %2, i32* %r, align 8 + store i32 %2, ptr %r, align 8 ; Big number is 5 billion. - %3 = call i8* @my_malloc(i8* null, i64 5000000000) - store i8* %3, i8** %p, align 8 ; To ensure objectsize isn't killed + %3 = call ptr @my_malloc(ptr null, i64 5000000000) + store ptr %3, ptr %p, align 8 ; To ensure objectsize isn't killed ; CHECK: call i32 @llvm.objectsize - %4 = call i32 @llvm.objectsize.i32.p0i8(i8* %3, i1 false) - store i32 %4, i32* %r, align 8 + %4 = call i32 @llvm.objectsize.i32.p0(ptr %3, i1 false) + store i32 %4, ptr %r, align 8 ret void } -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) +declare i32 @llvm.objectsize.i32.p0(ptr, i1) diff --git a/llvm/test/Transforms/InstCombine/allocsize.ll b/llvm/test/Transforms/InstCombine/allocsize.ll index 060da7c7ea057..ea7c28c5f4ea7 100644 --- a/llvm/test/Transforms/InstCombine/allocsize.ll +++ b/llvm/test/Transforms/InstCombine/allocsize.ll @@ -5,131 +5,130 @@ ; args, and to prove that arbitrary unfoldable values don't interfere with ; allocsize if they're not used by allocsize. -declare i8* @my_malloc(i8*, i32) allocsize(1) -declare i8* @my_calloc(i8*, i8*, i32, i32) allocsize(2, 3) +declare ptr @my_malloc(ptr, i32) allocsize(1) +declare ptr @my_calloc(ptr, ptr, i32, i32) allocsize(2, 3) ; CHECK-LABEL: define void @test_malloc -define void @test_malloc(i8** %p, i64* %r) { - %1 = call i8* @my_malloc(i8* null, i32 100) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_malloc(ptr %p, ptr %r) { + %1 = call ptr @my_malloc(ptr null, i32 100) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) ; CHECK: store i64 100 - store i64 %2, i64* %r, align 8 + store i64 %2, ptr %r, align 8 ret void } ; CHECK-LABEL: define void @test_calloc -define void @test_calloc(i8** %p, i64* %r) { - %1 = call i8* @my_calloc(i8* null, i8* null, i32 100, i32 5) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_calloc(ptr %p, ptr %r) { + %1 = call ptr @my_calloc(ptr null, ptr null, i32 100, i32 5) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) ; CHECK: store i64 500 - store i64 %2, i64* %r, align 8 + store i64 %2, ptr %r, align 8 ret void } ; Failure cases with non-constant values... ; CHECK-LABEL: define void @test_malloc_fails -define void @test_malloc_fails(i8** %p, i64* %r, i32 %n) { - %1 = call i8* @my_malloc(i8* null, i32 %n) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_malloc_fails(ptr %p, ptr %r, i32 %n) { + %1 = call ptr @my_malloc(ptr null, i32 %n) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - ; CHECK: @llvm.objectsize.i64.p0i8 - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) - store i64 %2, i64* %r, align 8 + ; CHECK: @llvm.objectsize.i64.p0 + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) + store i64 %2, ptr %r, align 8 ret void } ; CHECK-LABEL: define void @test_calloc_fails -define void @test_calloc_fails(i8** %p, i64* %r, i32 %n) { - %1 = call i8* @my_calloc(i8* null, i8* null, i32 %n, i32 5) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_calloc_fails(ptr %p, ptr %r, i32 %n) { + %1 = call ptr @my_calloc(ptr null, ptr null, i32 %n, i32 5) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - ; CHECK: @llvm.objectsize.i64.p0i8 - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) - store i64 %2, i64* %r, align 8 + ; CHECK: @llvm.objectsize.i64.p0 + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) + store i64 %2, ptr %r, align 8 - %3 = call i8* @my_calloc(i8* null, i8* null, i32 100, i32 %n) - store i8* %3, i8** %p, align 8 ; To ensure objectsize isn't killed + %3 = call ptr @my_calloc(ptr null, ptr null, i32 100, i32 %n) + store ptr %3, ptr %p, align 8 ; To ensure objectsize isn't killed - ; CHECK: @llvm.objectsize.i64.p0i8 - %4 = call i64 @llvm.objectsize.i64.p0i8(i8* %3, i1 false) - store i64 %4, i64* %r, align 8 + ; CHECK: @llvm.objectsize.i64.p0 + %4 = call i64 @llvm.objectsize.i64.p0(ptr %3, i1 false) + store i64 %4, ptr %r, align 8 ret void } -declare i8* @my_malloc_outofline(i8*, i32) #0 -declare i8* @my_calloc_outofline(i8*, i8*, i32, i32) #1 +declare ptr @my_malloc_outofline(ptr, i32) #0 +declare ptr @my_calloc_outofline(ptr, ptr, i32, i32) #1 ; Verifying that out of line allocsize is parsed correctly ; CHECK-LABEL: define void @test_outofline -define void @test_outofline(i8** %p, i64* %r) { - %1 = call i8* @my_malloc_outofline(i8* null, i32 100) - store i8* %1, i8** %p, align 8 ; To ensure objectsize isn't killed +define void @test_outofline(ptr %p, ptr %r) { + %1 = call ptr @my_malloc_outofline(ptr null, i32 100) + store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) ; CHECK: store i64 100 - store i64 %2, i64* %r, align 8 + store i64 %2, ptr %r, align 8 - %3 = call i8* @my_calloc_outofline(i8* null, i8* null, i32 100, i32 5) - store i8* %3, i8** %p, align 8 ; To ensure objectsize isn't killed + %3 = call ptr @my_calloc_outofline(ptr null, ptr null, i32 100, i32 5) + store ptr %3, ptr %p, align 8 ; To ensure objectsize isn't killed - %4 = call i64 @llvm.objectsize.i64.p0i8(i8* %3, i1 false) + %4 = call i64 @llvm.objectsize.i64.p0(ptr %3, i1 false) ; CHECK: store i64 500 - store i64 %4, i64* %r, align 8 + store i64 %4, ptr %r, align 8 ret void } -declare i8* @my_malloc_i64(i8*, i64) #0 -declare i8* @my_tiny_calloc(i8*, i8*, i8, i8) #1 -declare i8* @my_varied_calloc(i8*, i8*, i32, i8) #1 +declare ptr @my_malloc_i64(ptr, i64) #0 +declare ptr @my_tiny_calloc(ptr, ptr, i8, i8) #1 +declare ptr @my_varied_calloc(ptr, ptr, i32, i8) #1 ; CHECK-LABEL: define void @test_overflow -define void @test_overflow(i8** %p, i32* %r) { - %r64 = bitcast i32* %r to i64* +define void @test_overflow(ptr %p, ptr %r) { ; (2**31 + 1) * 2 > 2**31. So overflow. Yay. - %big_malloc = call i8* @my_calloc(i8* null, i8* null, i32 2147483649, i32 2) - store i8* %big_malloc, i8** %p, align 8 + %big_malloc = call ptr @my_calloc(ptr null, ptr null, i32 2147483649, i32 2) + store ptr %big_malloc, ptr %p, align 8 ; CHECK: @llvm.objectsize - %1 = call i32 @llvm.objectsize.i32.p0i8(i8* %big_malloc, i1 false) - store i32 %1, i32* %r, align 4 + %1 = call i32 @llvm.objectsize.i32.p0(ptr %big_malloc, i1 false) + store i32 %1, ptr %r, align 4 - %big_little_malloc = call i8* @my_tiny_calloc(i8* null, i8* null, i8 127, i8 4) - store i8* %big_little_malloc, i8** %p, align 8 + %big_little_malloc = call ptr @my_tiny_calloc(ptr null, ptr null, i8 127, i8 4) + store ptr %big_little_malloc, ptr %p, align 8 ; CHECK: store i32 508 - %2 = call i32 @llvm.objectsize.i32.p0i8(i8* %big_little_malloc, i1 false) - store i32 %2, i32* %r, align 4 + %2 = call i32 @llvm.objectsize.i32.p0(ptr %big_little_malloc, i1 false) + store i32 %2, ptr %r, align 4 ; malloc(2**33) - %big_malloc_i64 = call i8* @my_malloc_i64(i8* null, i64 8589934592) - store i8* %big_malloc_i64, i8** %p, align 8 + %big_malloc_i64 = call ptr @my_malloc_i64(ptr null, i64 8589934592) + store ptr %big_malloc_i64, ptr %p, align 8 ; CHECK: @llvm.objectsize - %3 = call i32 @llvm.objectsize.i32.p0i8(i8* %big_malloc_i64, i1 false) - store i32 %3, i32* %r, align 4 + %3 = call i32 @llvm.objectsize.i32.p0(ptr %big_malloc_i64, i1 false) + store i32 %3, ptr %r, align 4 - %4 = call i64 @llvm.objectsize.i64.p0i8(i8* %big_malloc_i64, i1 false) + %4 = call i64 @llvm.objectsize.i64.p0(ptr %big_malloc_i64, i1 false) ; CHECK: store i64 8589934592 - store i64 %4, i64* %r64, align 8 + store i64 %4, ptr %r, align 8 ; Just intended to ensure that we properly handle args of different types... - %varied_calloc = call i8* @my_varied_calloc(i8* null, i8* null, i32 1000, i8 5) - store i8* %varied_calloc, i8** %p, align 8 + %varied_calloc = call ptr @my_varied_calloc(ptr null, ptr null, i32 1000, i8 5) + store ptr %varied_calloc, ptr %p, align 8 ; CHECK: store i32 5000 - %5 = call i32 @llvm.objectsize.i32.p0i8(i8* %varied_calloc, i1 false) - store i32 %5, i32* %r, align 4 + %5 = call i32 @llvm.objectsize.i32.p0(ptr %varied_calloc, i1 false) + store i32 %5, ptr %r, align 4 ret void } @@ -137,18 +136,18 @@ define void @test_overflow(i8** %p, i32* %r) { ; CHECK-LABEL: define void @test_nobuiltin ; We had a bug where `nobuiltin` would cause `allocsize` to be ignored in ; @llvm.objectsize calculations. -define void @test_nobuiltin(i8** %p, i64* %r) { - %1 = call i8* @my_malloc(i8* null, i32 100) nobuiltin - store i8* %1, i8** %p, align 8 +define void @test_nobuiltin(ptr %p, ptr %r) { + %1 = call ptr @my_malloc(ptr null, i32 100) nobuiltin + store ptr %1, ptr %p, align 8 - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %1, i1 false) + %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false) ; CHECK: store i64 100 - store i64 %2, i64* %r, align 8 + store i64 %2, ptr %r, align 8 ret void } attributes #0 = { allocsize(1) } attributes #1 = { allocsize(2, 3) } -declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) +declare i32 @llvm.objectsize.i32.p0(ptr, i1) +declare i64 @llvm.objectsize.i64.p0(ptr, i1) diff --git a/llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll b/llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll index a72a6daa1e7e0..f181ba8a6fe4b 100644 --- a/llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll +++ b/llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll @@ -16,82 +16,82 @@ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ugt_and_min(i8* %x, i8* %y) { +define i1 @ugt_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_min( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_and_min_logical(i8* %x, i8* %y) { +define i1 @ugt_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_min_logical( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ugt_and_min_commute(<2 x i8>* %x, <2 x i8>* %y) { +define i1 @ugt_and_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_min_commute( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ugt <2 x i8>* %x, %y - %cmpeq = icmp eq <2 x i8>* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_and_min_commute_logical(<2 x i8>* %x, <2 x i8>* %y) { +define i1 @ugt_and_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_min_commute_logical( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ugt <2 x i8>* %x, %y - %cmpeq = icmp eq <2 x i8>* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } -define i1 @ugt_swap_and_min(i8* %x, i8* %y) { +define i1 @ugt_swap_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_min( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_swap_and_min_logical(i8* %x, i8* %y) { +define i1 @ugt_swap_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_min_logical( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ugt_swap_and_min_commute(i8* %x, i8* %y) { +define i1 @ugt_swap_and_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_min_commute( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_swap_and_min_commute_logical(i8* %x, i8* %y) { +define i1 @ugt_swap_and_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_min_commute_logical( ; CHECK-NEXT: ret i1 false ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } @@ -102,82 +102,82 @@ define i1 @ugt_swap_and_min_commute_logical(i8* %x, i8* %y) { ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ule_or_not_min(i427* %x, i427* %y) { +define i1 @ule_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_not_min( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp ule i427* %x, %y - %cmpeq = icmp ne i427* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_or_not_min_logical(i427* %x, i427* %y) { +define i1 @ule_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_not_min_logical( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp ule i427* %x, %y - %cmpeq = icmp ne i427* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ule_or_not_min_commute(<3 x i9>* %x, <3 x i9>* %y) { +define i1 @ule_or_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_not_min_commute( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp ule <3 x i9>* %x, %y - %cmpeq = icmp ne <3 x i9>* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_or_not_min_commute_logical(<3 x i9>* %x, <3 x i9>* %y) { +define i1 @ule_or_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_not_min_commute_logical( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp ule <3 x i9>* %x, %y - %cmpeq = icmp ne <3 x i9>* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } -define i1 @ule_swap_or_not_min(i8* %x, i8* %y) { +define i1 @ule_swap_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_not_min( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_swap_or_not_min_logical(i8* %x, i8* %y) { +define i1 @ule_swap_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_not_min_logical( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ule_swap_or_not_min_commute(i8* %x, i8* %y) { +define i1 @ule_swap_or_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_not_min_commute( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_swap_or_not_min_commute_logical(i8* %x, i8* %y) { +define i1 @ule_swap_or_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_not_min_commute_logical( ; CHECK-NEXT: ret i1 true ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } @@ -188,90 +188,90 @@ define i1 @ule_swap_or_not_min_commute_logical(i8* %x, i8* %y) { ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ule_and_min(i8* %x, i8* %y) { +define i1 @ule_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_and_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_and_min_logical(i8* %x, i8* %y) { +define i1 @ule_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_and_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ule_and_min_commute(i8* %x, i8* %y) { +define i1 @ule_and_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_and_min_commute( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_and_min_commute_logical(i8* %x, i8* %y) { +define i1 @ule_and_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_and_min_commute_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } -define i1 @ule_swap_and_min(i8* %x, i8* %y) { +define i1 @ule_swap_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_and_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_swap_and_min_logical(i8* %x, i8* %y) { +define i1 @ule_swap_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_and_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ule_swap_and_min_commute(i8* %x, i8* %y) { +define i1 @ule_swap_and_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_and_min_commute( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_swap_and_min_commute_logical(i8* %x, i8* %y) { +define i1 @ule_swap_and_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_and_min_commute_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } @@ -282,94 +282,94 @@ define i1 @ule_swap_and_min_commute_logical(i8* %x, i8* %y) { ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ule_or_min(i8* %x, i8* %y) { +define i1 @ule_or_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_min( -; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_or_min_logical(i8* %x, i8* %y) { +define i1 @ule_or_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_min_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ule_or_min_commute(i8* %x, i8* %y) { +define i1 @ule_or_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_min_commute( -; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_or_min_commute_logical(i8* %x, i8* %y) { +define i1 @ule_or_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_or_min_commute_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8* [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]] ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp ule i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp ule ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } -define i1 @ule_swap_or_min(i8* %x, i8* %y) { +define i1 @ule_swap_or_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_min( -; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp uge ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ule_swap_or_min_logical(i8* %x, i8* %y) { +define i1 @ule_swap_or_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_min_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp uge ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ule_swap_or_min_commute(i8* %x, i8* %y) { +define i1 @ule_swap_or_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_min_commute( -; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp uge ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ule_swap_or_min_commute_logical(i8* %x, i8* %y) { +define i1 @ule_swap_or_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ule_swap_or_min_commute_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8* [[Y:%.*]], [[X:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp uge ptr [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]] ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp uge i8* %y, %x - %cmpeq = icmp eq i8* %x, null + %cmp = icmp uge ptr %y, %x + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } @@ -380,94 +380,94 @@ define i1 @ule_swap_or_min_commute_logical(i8* %x, i8* %y) { ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ugt_and_not_min(i8* %x, i8* %y) { +define i1 @ugt_and_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_not_min( -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_and_not_min_logical(i8* %x, i8* %y) { +define i1 @ugt_and_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_not_min_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ugt_and_not_min_commute(i8* %x, i8* %y) { +define i1 @ugt_and_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_not_min_commute( -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_and_not_min_commute_logical(i8* %x, i8* %y) { +define i1 @ugt_and_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_and_not_min_commute_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8* [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp ugt ptr [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } -define i1 @ugt_swap_and_not_min(i8* %x, i8* %y) { +define i1 @ugt_swap_and_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_not_min( -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_swap_and_not_min_logical(i8* %x, i8* %y) { +define i1 @ugt_swap_and_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_not_min_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @ugt_swap_and_not_min_commute(i8* %x, i8* %y) { +define i1 @ugt_swap_and_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_not_min_commute( -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8* [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: ret i1 [[CMP]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_swap_and_not_min_commute_logical(i8* %x, i8* %y) { +define i1 @ugt_swap_and_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_and_not_min_commute_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8* [[Y:%.*]], [[X:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } @@ -478,246 +478,246 @@ define i1 @ugt_swap_and_not_min_commute_logical(i8* %x, i8* %y) { ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -define i1 @ugt_or_not_min(i8* %x, i8* %y) { +define i1 @ugt_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_or_not_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_or_not_min_logical(i8* %x, i8* %y) { +define i1 @ugt_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_or_not_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ugt_or_not_min_commute(i8* %x, i8* %y) { +define i1 @ugt_or_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_or_not_min_commute( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_or_not_min_commute_logical(i8* %x, i8* %y) { +define i1 @ugt_or_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_or_not_min_commute_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ugt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ugt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } -define i1 @ugt_swap_or_not_min(i8* %x, i8* %y) { +define i1 @ugt_swap_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_or_not_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @ugt_swap_or_not_min_logical(i8* %x, i8* %y) { +define i1 @ugt_swap_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_or_not_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ult i8* %y, %x - %cmpeq = icmp ne i8* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @ugt_swap_or_not_min_commute(i823* %x, i823* %y) { +define i1 @ugt_swap_or_not_min_commute(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_or_not_min_commute( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i823* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ult i823* %y, %x - %cmpeq = icmp ne i823* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmpeq, %cmp ret i1 %r } -define i1 @ugt_swap_or_not_min_commute_logical(i823* %x, i823* %y) { +define i1 @ugt_swap_or_not_min_commute_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @ugt_swap_or_not_min_commute_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i823* [[X:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null ; CHECK-NEXT: ret i1 [[CMPEQ]] ; - %cmp = icmp ult i823* %y, %x - %cmpeq = icmp ne i823* %x, null + %cmp = icmp ult ptr %y, %x + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmpeq, i1 true, i1 %cmp ret i1 %r } -define i1 @sgt_and_min(i9* %x, i9* %y) { +define i1 @sgt_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_and_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i9* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i9* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp slt ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sgt i9* %x, %y - %cmpeq = icmp eq i9* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @sgt_and_min_logical(i9* %x, i9* %y) { +define i1 @sgt_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_and_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i9* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i9* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp slt ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sgt i9* %x, %y - %cmpeq = icmp eq i9* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @sle_or_not_min(i427* %x, i427* %y) { +define i1 @sle_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @sle_or_not_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i427* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i427* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp sge ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = or i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sle i427* %x, %y - %cmpeq = icmp ne i427* %x, null + %cmp = icmp sle ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @sle_or_not_min_logical(i427* %x, i427* %y) { +define i1 @sle_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @sle_or_not_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i427* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i427* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp sge ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = or i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sle i427* %x, %y - %cmpeq = icmp ne i427* %x, null + %cmp = icmp sle ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @sle_and_min(i8* %x, i8* %y) { +define i1 @sle_and_min(ptr %x, ptr %y) { ; CHECK-LABEL: @sle_and_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i8* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp sge ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sle i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp sle ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @sle_and_min_logical(i8* %x, i8* %y) { +define i1 @sle_and_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @sle_and_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i8* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp sge ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sle i8* %x, %y - %cmpeq = icmp eq i8* %x, null + %cmp = icmp sle ptr %x, %y + %cmpeq = icmp eq ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @sgt_and_not_min(i8* %x, i8* %y) { +define i1 @sgt_and_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_and_not_min( -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8* [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt ptr [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = and i1 [[CMP]], [[CMPEQ]] ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp sgt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = and i1 %cmp, %cmpeq ret i1 %r } -define i1 @sgt_and_not_min_logical(i8* %x, i8* %y) { +define i1 @sgt_and_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_and_not_min_logical( -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8* [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt ptr [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X]], null ; CHECK-NEXT: [[R:%.*]] = and i1 [[CMP]], [[CMPEQ]] ; CHECK-NEXT: ret i1 [[R]] ; - %cmp = icmp sgt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 %cmpeq, i1 false ret i1 %r } -define i1 @sgt_or_not_min(i8* %x, i8* %y) { +define i1 @sgt_or_not_min(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_or_not_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i8* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp slt ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = or i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sgt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = or i1 %cmp, %cmpeq ret i1 %r } -define i1 @sgt_or_not_min_logical(i8* %x, i8* %y) { +define i1 @sgt_or_not_min_logical(ptr %x, ptr %y) { ; CHECK-LABEL: @sgt_or_not_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8* [[X:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i8* [[Y:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne ptr [[X:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp slt ptr [[Y:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = or i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmp = icmp sgt i8* %x, %y - %cmpeq = icmp ne i8* %x, null + %cmp = icmp sgt ptr %x, %y + %cmpeq = icmp ne ptr %x, null %r = select i1 %cmp, i1 true, i1 %cmpeq ret i1 %r } -define i1 @slt_and_min(i8* %a, i8* %b) { +define i1 @slt_and_min(ptr %a, ptr %b) { ; CHECK-LABEL: @slt_and_min( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[A:%.*]], null -; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i8* [[B:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[A:%.*]], null +; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt ptr [[B:%.*]], null ; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[CMPEQ]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP2]] ; - %cmpeq = icmp eq i8* %a, null - %cmp = icmp slt i8* %a, %b + %cmpeq = icmp eq ptr %a, null + %cmp = icmp slt ptr %a, %b %r = and i1 %cmpeq, %cmp ret i1 %r } -define i1 @slt_and_min_logical(i8* %a, i8* %b) { +define i1 @slt_and_min_logical(ptr %a, ptr %b) { ; CHECK-LABEL: @slt_and_min_logical( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8* [[A:%.*]], null -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8* [[B:%.*]], null +; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq ptr [[A:%.*]], null +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt ptr [[B:%.*]], null ; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false ; CHECK-NEXT: ret i1 [[R]] ; - %cmpeq = icmp eq i8* %a, null - %cmp = icmp slt i8* %a, %b + %cmpeq = icmp eq ptr %a, null + %cmp = icmp slt ptr %a, %b %r = select i1 %cmpeq, i1 %cmp, i1 false ret i1 %r } diff --git a/llvm/test/Transforms/InstCombine/and-or-icmps.ll b/llvm/test/Transforms/InstCombine/and-or-icmps.ll index 3dc35b82a7eb2..7079922f3d9fa 100644 --- a/llvm/test/Transforms/InstCombine/and-or-icmps.ll +++ b/llvm/test/Transforms/InstCombine/and-or-icmps.ll @@ -365,7 +365,7 @@ define <2 x i1> @and_ne_with_diff_one_splatvec(<2 x i32> %x) { define void @simplify_before_foldAndOfICmps() { ; CHECK-LABEL: @simplify_before_foldAndOfICmps( ; CHECK-NEXT: [[A8:%.*]] = alloca i16, align 2 -; CHECK-NEXT: [[L7:%.*]] = load i16, i16* [[A8]], align 2 +; CHECK-NEXT: [[L7:%.*]] = load i16, ptr [[A8]], align 2 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i16 [[L7]], -1 ; CHECK-NEXT: [[B11:%.*]] = zext i1 [[TMP1]] to i16 ; CHECK-NEXT: [[C10:%.*]] = icmp ugt i16 [[L7]], [[B11]] @@ -378,21 +378,21 @@ define void @simplify_before_foldAndOfICmps() { ; CHECK-NEXT: [[TMP3:%.*]] = xor i1 [[C10]], true ; CHECK-NEXT: [[C18:%.*]] = or i1 [[C7]], [[TMP3]] ; CHECK-NEXT: [[TMP4:%.*]] = sext i1 [[C3]] to i64 -; CHECK-NEXT: [[G26:%.*]] = getelementptr i1, i1* null, i64 [[TMP4]] -; CHECK-NEXT: store i16 [[L7]], i16* undef, align 2 -; CHECK-NEXT: store i1 [[C18]], i1* undef, align 1 -; CHECK-NEXT: store i1* [[G26]], i1** undef, align 8 +; CHECK-NEXT: [[G26:%.*]] = getelementptr i1, ptr null, i64 [[TMP4]] +; CHECK-NEXT: store i16 [[L7]], ptr undef, align 2 +; CHECK-NEXT: store i1 [[C18]], ptr undef, align 1 +; CHECK-NEXT: store ptr [[G26]], ptr undef, align 8 ; CHECK-NEXT: ret void ; %A8 = alloca i16 - %L7 = load i16, i16* %A8 - %G21 = getelementptr i16, i16* %A8, i8 -1 + %L7 = load i16, ptr %A8 + %G21 = getelementptr i16, ptr %A8, i8 -1 %B11 = udiv i16 %L7, -1 - %G4 = getelementptr i16, i16* %A8, i16 %B11 - %L2 = load i16, i16* %G4 - %L = load i16, i16* %G4 + %G4 = getelementptr i16, ptr %A8, i16 %B11 + %L2 = load i16, ptr %G4 + %L = load i16, ptr %G4 %B23 = mul i16 %B11, %B11 - %L4 = load i16, i16* %A8 + %L4 = load i16, ptr %A8 %B21 = sdiv i16 %L7, %L4 %B7 = sub i16 0, %B21 %B18 = mul i16 %B23, %B7 @@ -409,12 +409,12 @@ define void @simplify_before_foldAndOfICmps() { %B33 = or i16 %B29, %L4 %C13 = icmp uge i1 %C5, %B1 %C3 = icmp ult i1 %C13, %C6 - store i16 undef, i16* %G21 + store i16 undef, ptr %G21 %C18 = icmp ule i1 %C10, %C7 - %G26 = getelementptr i1, i1* null, i1 %C3 - store i16 %B33, i16* undef - store i1 %C18, i1* undef - store i1* %G26, i1** undef + %G26 = getelementptr i1, ptr null, i1 %C3 + store i16 %B33, ptr undef + store i1 %C18, ptr undef + store ptr %G26, ptr undef ret void } diff --git a/llvm/test/Transforms/InstCombine/and-xor-or.ll b/llvm/test/Transforms/InstCombine/and-xor-or.ll index 7da7f6089c340..52721e03c17c0 100644 --- a/llvm/test/Transforms/InstCombine/and-xor-or.ll +++ b/llvm/test/Transforms/InstCombine/and-xor-or.ll @@ -107,16 +107,16 @@ define i32 @and_xor_not_common_op(i32 %a, i32 %b) { ; a & (a ^ ~b) --> a & b -define i32 @and_xor_not_common_op_extrause(i32 %a, i32 %b, i32* %dst) { +define i32 @and_xor_not_common_op_extrause(i32 %a, i32 %b, ptr %dst) { ; CHECK-LABEL: define {{[^@]+}}@and_xor_not_common_op_extrause -; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32* [[DST:%.*]]) { +; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], ptr [[DST:%.*]]) { ; CHECK-NEXT: [[B2:%.*]] = xor i32 [[B]], -1 -; CHECK-NEXT: store i32 [[B2]], i32* [[DST]], align 4 +; CHECK-NEXT: store i32 [[B2]], ptr [[DST]], align 4 ; CHECK-NEXT: [[T4:%.*]] = and i32 [[A]], [[B]] ; CHECK-NEXT: ret i32 [[T4]] ; %b2 = xor i32 %b, -1 - store i32 %b2, i32* %dst + store i32 %b2, ptr %dst %t2 = xor i32 %a, %b2 %t4 = and i32 %t2, %a ret i32 %t4 diff --git a/llvm/test/Transforms/InstCombine/and.ll b/llvm/test/Transforms/InstCombine/and.ll index c5e3b96a79d39..7865d2be5f7a3 100644 --- a/llvm/test/Transforms/InstCombine/and.ll +++ b/llvm/test/Transforms/InstCombine/and.ll @@ -132,17 +132,17 @@ define i32 @test10(i32 %A) { ret i32 %D } -define i32 @test11(i32 %A, i32* %P) { +define i32 @test11(i32 %A, ptr %P) { ; CHECK-LABEL: @test11( ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[A:%.*]], -4 ; CHECK-NEXT: [[C:%.*]] = xor i32 [[TMP1]], 15 -; CHECK-NEXT: store i32 [[C]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[C]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: ret i32 3 ; %B = or i32 %A, 3 %C = xor i32 %B, 12 ; additional use of C - store i32 %C, i32* %P + store i32 %C, ptr %P ; %C = and uint %B, 3 --> 3 %D = and i32 %C, 3 ret i32 %D @@ -416,15 +416,15 @@ define i32 @ashr_lowmask_use(i32 %x) { ret i32 %r } -define <2 x i8> @ashr_lowmask_use_splat(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i8> @ashr_lowmask_use_splat(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @ashr_lowmask_use_splat( ; CHECK-NEXT: [[A:%.*]] = ashr <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[A]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[A]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[R:%.*]] = lshr <2 x i8> [[X]], ; CHECK-NEXT: ret <2 x i8> [[R]] ; %a = ashr <2 x i8> %x, - store <2 x i8> %a, <2 x i8>* %p + store <2 x i8> %a, ptr %p %r = and <2 x i8> %a, ret <2 x i8> %r } @@ -1437,17 +1437,17 @@ define i32 @not_lowmask_sext_in_reg2(i32 %x) { ret i32 %and } -define <2 x i32> @lowmask_sext_in_reg_splat(<2 x i32> %x, <2 x i32>* %p) { +define <2 x i32> @lowmask_sext_in_reg_splat(<2 x i32> %x, ptr %p) { ; CHECK-LABEL: @lowmask_sext_in_reg_splat( ; CHECK-NEXT: [[L:%.*]] = shl <2 x i32> [[X:%.*]], ; CHECK-NEXT: [[R:%.*]] = ashr exact <2 x i32> [[L]], -; CHECK-NEXT: store <2 x i32> [[R]], <2 x i32>* [[P:%.*]], align 8 +; CHECK-NEXT: store <2 x i32> [[R]], ptr [[P:%.*]], align 8 ; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[X]], ; CHECK-NEXT: ret <2 x i32> [[AND]] ; %l = shl <2 x i32> %x, %r = ashr <2 x i32> %l, - store <2 x i32> %r, <2 x i32>* %p + store <2 x i32> %r, ptr %p %and = and <2 x i32> %r, ret <2 x i32> %and } @@ -1488,15 +1488,15 @@ define i8 @lowmask_add_2_uses(i8 %x) { ret i8 %r } -define <2 x i8> @lowmask_add_2_splat(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i8> @lowmask_add_2_splat(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @lowmask_add_2_splat( ; CHECK-NEXT: [[A:%.*]] = add <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[A]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[A]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[X]], ; CHECK-NEXT: ret <2 x i8> [[R]] ; %a = add <2 x i8> %x, ; 0xc0 - store <2 x i8> %a, <2 x i8>* %p + store <2 x i8> %a, ptr %p %r = and <2 x i8> %a, ; 0x3f ret <2 x i8> %r } @@ -1531,41 +1531,41 @@ define i8 @not_lowmask_add2(i8 %x) { ret i8 %r } -define <2 x i8> @lowmask_add_splat(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i8> @lowmask_add_splat(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @lowmask_add_splat( ; CHECK-NEXT: [[A:%.*]] = add <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[A]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[A]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[X]], ; CHECK-NEXT: ret <2 x i8> [[R]] ; %a = add <2 x i8> %x, ; 0xc0 - store <2 x i8> %a, <2 x i8>* %p + store <2 x i8> %a, ptr %p %r = and <2 x i8> %a, ; 0x20 ret <2 x i8> %r } -define <2 x i8> @lowmask_add_splat_undef(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i8> @lowmask_add_splat_undef(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @lowmask_add_splat_undef( ; CHECK-NEXT: [[A:%.*]] = add <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[A]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[A]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[A]], ; CHECK-NEXT: ret <2 x i8> [[R]] ; %a = add <2 x i8> %x, ; 0xc0 - store <2 x i8> %a, <2 x i8>* %p + store <2 x i8> %a, ptr %p %r = and <2 x i8> %a, ; 0x20 ret <2 x i8> %r } -define <2 x i8> @lowmask_add_vec(<2 x i8> %x, <2 x i8>* %p) { +define <2 x i8> @lowmask_add_vec(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @lowmask_add_vec( ; CHECK-NEXT: [[A:%.*]] = add <2 x i8> [[X:%.*]], -; CHECK-NEXT: store <2 x i8> [[A]], <2 x i8>* [[P:%.*]], align 2 +; CHECK-NEXT: store <2 x i8> [[A]], ptr [[P:%.*]], align 2 ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[A]], ; CHECK-NEXT: ret <2 x i8> [[R]] ; %a = add <2 x i8> %x, ; 0xe0, 0xc0 - store <2 x i8> %a, <2 x i8>* %p + store <2 x i8> %a, ptr %p %r = and <2 x i8> %a, ; 0x10, 0x20 ret <2 x i8> %r } diff --git a/llvm/test/Transforms/InstCombine/annotation-intrinsic.ll b/llvm/test/Transforms/InstCombine/annotation-intrinsic.ll index 88b5860693b6c..eaa8fb5493de6 100644 --- a/llvm/test/Transforms/InstCombine/annotation-intrinsic.ll +++ b/llvm/test/Transforms/InstCombine/annotation-intrinsic.ll @@ -6,20 +6,20 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" -declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32) #1 +declare i32 @llvm.annotation.i32(i32, ptr, ptr, i32) #1 -define dso_local i32 @annotated(i32* %c) local_unnamed_addr #0 { +define dso_local i32 @annotated(ptr %c) local_unnamed_addr #0 { ; CHECK-LABEL: @annotated( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[C:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.annotation.i32(i32 [[TMP0]], i8* undef, i8* undef, i32 undef) +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.annotation.i32(i32 [[TMP0]], ptr undef, ptr undef, i32 undef) ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]] ; CHECK-NEXT: ret i32 [[ADD]] ; entry: - %0 = load i32, i32* %c, align 4 - %1 = call i32 @llvm.annotation.i32(i32 %0, i8* undef, i8* undef, i32 undef) - %2 = load i32, i32* %c, align 4 + %0 = load i32, ptr %c, align 4 + %1 = call i32 @llvm.annotation.i32(i32 %0, ptr undef, ptr undef, i32 undef) + %2 = load i32, ptr %c, align 4 %add = add nsw i32 %1, %2 ret i32 %add } diff --git a/llvm/test/Transforms/InstCombine/annotations.ll b/llvm/test/Transforms/InstCombine/annotations.ll index fc2d4777bf72b..a96da3cf48c0c 100644 --- a/llvm/test/Transforms/InstCombine/annotations.ll +++ b/llvm/test/Transforms/InstCombine/annotations.ll @@ -5,28 +5,24 @@ ; Make sure !annotation metadata is added to new instructions, if the source ; instruction has !annotation metadata. -define i1 @fold_to_new_instruction(i8* %a, i8* %b) { +define i1 @fold_to_new_instruction(ptr %a, ptr %b) { ; CHECK-LABEL: define {{.+}} @fold_to_new_instruction({{.+}} -; CHECK-NEXT: [[C:%.*]] = icmp uge i8* [[A:%.*]], [[B:%[a-z]*]], !annotation [[ANN:![0-9]+]] +; CHECK-NEXT: [[C:%.*]] = icmp uge ptr [[A:%.*]], [[B:%[a-z]*]], !annotation [[ANN:![0-9]+]] ; CHECK-NEXT: ret i1 [[C]] ; - %a.c = bitcast i8* %a to i32*, !annotation !0 - %b.c = bitcast i8* %b to i32*, !annotation !0 - %c = icmp uge i32* %a.c, %b.c, !annotation !0 + %c = icmp uge ptr %a, %b, !annotation !0 ret i1 %c } ; Make sure !annotation is not added to new instructions if the source ; instruction does not have it (even if some folded operands do have ; !annotation). -define i1 @fold_to_new_instruction2(i8* %a, i8* %b) { +define i1 @fold_to_new_instruction2(ptr %a, ptr %b) { ; CHECK-LABEL: define {{.+}} @fold_to_new_instruction2({{.+}} -; CHECK-NEXT: [[C:%.*]] = icmp uge i8* [[A:%.*]], [[B:%[a-z]+]] +; CHECK-NEXT: [[C:%.*]] = icmp uge ptr [[A:%.*]], [[B:%[a-z]+]] ; CHECK-NEXT: ret i1 [[C]] ; - %a.c = bitcast i8* %a to i32*, !annotation !0 - %b.c = bitcast i8* %b to i32*, !annotation !0 - %c = icmp uge i32* %a.c, %b.c + %c = icmp uge ptr %a, %b ret i1 %c } @@ -45,108 +41,108 @@ define i32 @do_not_add_annotation_to_existing_instr(i32 %a, i32 %b) { ; memcpy can be expanded inline with load/store. Verify that we keep the ; !annotation metadata. -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind +declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind -define void @copy_1_byte(i8* %d, i8* %s) { +define void @copy_1_byte(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @copy_1_byte({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 1, i1 false), !annotation !0 + call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false), !annotation !0 ret void } -declare i8* @memcpy(i8* noalias returned, i8* noalias nocapture readonly, i64) nofree nounwind +declare ptr @memcpy(ptr noalias returned, ptr noalias nocapture readonly, i64) nofree nounwind -define void @libcallcopy_1_byte(i8* %d, i8* %s) { +define void @libcallcopy_1_byte(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @libcallcopy_1_byte({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @memcpy(i8* %d, i8* %s, i64 1), !annotation !0 + call ptr @memcpy(ptr %d, ptr %s, i64 1), !annotation !0 ret void } -declare i8* @__memcpy_chk(i8*, i8*, i64, i64) nofree nounwind +declare ptr @__memcpy_chk(ptr, ptr, i64, i64) nofree nounwind -define void @libcallcopy_1_byte_chk(i8* %d, i8* %s) { +define void @libcallcopy_1_byte_chk(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @libcallcopy_1_byte_chk({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @__memcpy_chk(i8* %d, i8* %s, i64 1, i64 1), !annotation !0 + call ptr @__memcpy_chk(ptr %d, ptr %s, i64 1, i64 1), !annotation !0 ret void } -declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) nounwind +declare void @llvm.memmove.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1) nounwind -define void @move_1_byte(i8* %d, i8* %s) { +define void @move_1_byte(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @move_1_byte({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call void @llvm.memmove.p0i8.p0i8.i32(i8* %d, i8* %s, i32 1, i1 false), !annotation !0 + call void @llvm.memmove.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false), !annotation !0 ret void } -declare i8* @memmove(i8* returned, i8* nocapture readonly, i64) nofree nounwind +declare ptr @memmove(ptr returned, ptr nocapture readonly, i64) nofree nounwind -define void @libcallmove_1_byte(i8* %d, i8* %s) { +define void @libcallmove_1_byte(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @libcallmove_1_byte({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @memmove(i8* %d, i8* %s, i64 1), !annotation !0 + call ptr @memmove(ptr %d, ptr %s, i64 1), !annotation !0 ret void } -declare i8* @__memmove_chk(i8*, i8*, i64, i64) nofree nounwind +declare ptr @__memmove_chk(ptr, ptr, i64, i64) nofree nounwind -define void @libcallmove_1_byte_chk(i8* %d, i8* %s) { +define void @libcallmove_1_byte_chk(ptr %d, ptr %s) { ; CHECK-LABEL: define {{.+}} @libcallmove_1_byte_chk({{.+}} -; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]] -; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr [[S:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 [[TMP1]], ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @__memmove_chk(i8* %d, i8* %s, i64 1, i64 1), !annotation !0 + call ptr @__memmove_chk(ptr %d, ptr %s, i64 1, i64 1), !annotation !0 ret void } -declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) argmemonly nounwind +declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1) argmemonly nounwind -define void @set_1_byte(i8* %d) { +define void @set_1_byte(ptr %d) { ; CHECK-LABEL: define {{.+}} @set_1_byte({{.+}} -; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 1, ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call void @llvm.memset.p0i8.i32(i8* %d, i8 1, i32 1, i1 false), !annotation !0 + call void @llvm.memset.p0.i32(ptr %d, i8 1, i32 1, i1 false), !annotation !0 ret void } -declare i8* @memset(i8*, i32, i64) nofree +declare ptr @memset(ptr, i32, i64) nofree -define void @libcall_set_1_byte(i8* %d) { +define void @libcall_set_1_byte(ptr %d) { ; CHECK-LABEL: define {{.+}} @libcall_set_1_byte({{.+}} -; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 1, ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @memset(i8* %d, i32 1, i64 1), !annotation !0 + call ptr @memset(ptr %d, i32 1, i64 1), !annotation !0 ret void } -declare i8* @__memset_chk(i8*, i32, i64, i64) nofree +declare ptr @__memset_chk(ptr, i32, i64, i64) nofree -define void @libcall_set_1_byte_chk(i8* %d) { +define void @libcall_set_1_byte_chk(ptr %d) { ; CHECK-LABEL: define {{.+}} @libcall_set_1_byte_chk({{.+}} -; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]] +; CHECK-NEXT: store i8 1, ptr [[D:%.*]], align 1, !annotation [[ANN]] ; CHECK-NEXT: ret void ; - call i8* @__memset_chk(i8* %d, i32 1, i64 1, i64 1), !annotation !0 + call ptr @__memset_chk(ptr %d, i32 1, i64 1, i64 1), !annotation !0 ret void } diff --git a/llvm/test/Transforms/InstCombine/apint-and.ll b/llvm/test/Transforms/InstCombine/apint-and.ll index 793b25e548280..c5f2087ee02fd 100644 --- a/llvm/test/Transforms/InstCombine/apint-and.ll +++ b/llvm/test/Transforms/InstCombine/apint-and.ll @@ -40,16 +40,16 @@ define i1 @test4(i37 %x) { ret i1 %B } -define i7 @test5(i7 %A, i7* %P) { +define i7 @test5(i7 %A, ptr %P) { ; CHECK-LABEL: @test5( ; CHECK-NEXT: [[TMP1:%.*]] = and i7 [[A:%.*]], -4 ; CHECK-NEXT: [[C:%.*]] = xor i7 [[TMP1]], 15 -; CHECK-NEXT: store i7 [[C]], i7* [[P:%.*]], align 1 +; CHECK-NEXT: store i7 [[C]], ptr [[P:%.*]], align 1 ; CHECK-NEXT: ret i7 3 ; %B = or i7 %A, 3 %C = xor i7 %B, 12 - store i7 %C, i7* %P + store i7 %C, ptr %P %r = and i7 %C, 3 ret i7 %r } @@ -101,16 +101,16 @@ define i1 @test11(i737 %x) { ret i1 %B } -define i117 @test12(i117 %A, i117* %P) { +define i117 @test12(i117 %A, ptr %P) { ; CHECK-LABEL: @test12( ; CHECK-NEXT: [[TMP1:%.*]] = and i117 [[A:%.*]], -4 ; CHECK-NEXT: [[C:%.*]] = xor i117 [[TMP1]], 15 -; CHECK-NEXT: store i117 [[C]], i117* [[P:%.*]], align 4 +; CHECK-NEXT: store i117 [[C]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: ret i117 3 ; %B = or i117 %A, 3 %C = xor i117 %B, 12 - store i117 %C, i117* %P + store i117 %C, ptr %P %r = and i117 %C, 3 ret i117 %r } diff --git a/llvm/test/Transforms/InstCombine/apint-call-cast-target.ll b/llvm/test/Transforms/InstCombine/apint-call-cast-target.ll index 6eaefa04ea7be..d491762133549 100644 --- a/llvm/test/Transforms/InstCombine/apint-call-cast-target.ll +++ b/llvm/test/Transforms/InstCombine/apint-call-cast-target.ll @@ -5,28 +5,28 @@ target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" declare i32 @main2() -declare i7* @ctime2(i999*) +declare ptr @ctime2(ptr) -define i7* @ctime(i999*) { +define ptr @ctime(ptr) { ; CHECK-LABEL: @ctime( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[I0:%.*]] = call i32 @main2() -; CHECK-NEXT: [[TMP1:%.*]] = inttoptr i32 [[I0]] to i7* -; CHECK-NEXT: ret i7* [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = inttoptr i32 [[I0]] to ptr +; CHECK-NEXT: ret ptr [[TMP1]] ; entry: - %i0 = call i7* bitcast (i32 ()* @main2 to i7* ()*)( ) - ret i7* %i0 + %i0 = call ptr @main2( ) + ret ptr %i0 } define i32 @main() { ; CHECK-LABEL: @main( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[I1:%.*]] = call i7* @ctime2(i999* null) -; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i7* [[I1]] to i32 +; CHECK-NEXT: [[I1:%.*]] = call ptr @ctime2(ptr null) +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[I1]] to i32 ; CHECK-NEXT: ret i32 [[TMP0]] ; entry: - %i1 = call i32 bitcast (i7* (i999*)* @ctime2 to i32 (i99*)*)( i99* null ) + %i1 = call i32 @ctime2( ptr null ) ret i32 %i1 } diff --git a/llvm/test/Transforms/InstCombine/apint-shift.ll b/llvm/test/Transforms/InstCombine/apint-shift.ll index 98948a64dd6f2..6b5a1c8eb8fe0 100644 --- a/llvm/test/Transforms/InstCombine/apint-shift.ll +++ b/llvm/test/Transforms/InstCombine/apint-shift.ll @@ -565,7 +565,7 @@ define i40 @test26(i40 %A) { define i177 @ossfuzz_9880(i177 %X) { ; CHECK-LABEL: @ossfuzz_9880( ; CHECK-NEXT: [[A:%.*]] = alloca i177, align 8 -; CHECK-NEXT: [[L1:%.*]] = load i177, i177* [[A]], align 8 +; CHECK-NEXT: [[L1:%.*]] = load i177, ptr [[A]], align 8 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i177 [[L1]], -1 ; CHECK-NEXT: [[B5_NEG:%.*]] = sext i1 [[TMP1]] to i177 ; CHECK-NEXT: [[B14:%.*]] = add i177 [[L1]], [[B5_NEG]] @@ -574,7 +574,7 @@ define i177 @ossfuzz_9880(i177 %X) { ; CHECK-NEXT: ret i177 [[B1]] ; %A = alloca i177 - %L1 = load i177, i177* %A + %L1 = load i177, ptr %A %B = or i177 0, -1 %B5 = udiv i177 %L1, %B %B4 = add i177 %B5, %B diff --git a/llvm/test/Transforms/InstCombine/ashr-lshr.ll b/llvm/test/Transforms/InstCombine/ashr-lshr.ll index d14258fa04829..870847921f025 100644 --- a/llvm/test/Transforms/InstCombine/ashr-lshr.ll +++ b/llvm/test/Transforms/InstCombine/ashr-lshr.ll @@ -474,15 +474,15 @@ define i32 @lshr_sub(i32 %x, i32 %y) { ; negative test - one-use -define i32 @lshr_sub_nsw_extra_use(i32 %x, i32 %y, i32* %p) { +define i32 @lshr_sub_nsw_extra_use(i32 %x, i32 %y, ptr %p) { ; CHECK-LABEL: @lshr_sub_nsw_extra_use( ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: store i32 [[SUB]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[SUB]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[SHR:%.*]] = lshr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[SHR]] ; %sub = sub nsw i32 %x, %y - store i32 %sub, i32* %p + store i32 %sub, ptr %p %shr = lshr i32 %sub, 31 ret i32 %shr } @@ -548,15 +548,15 @@ define i32 @ashr_sub(i32 %x, i32 %y) { ; negative test - one-use -define i32 @ashr_sub_nsw_extra_use(i32 %x, i32 %y, i32* %p) { +define i32 @ashr_sub_nsw_extra_use(i32 %x, i32 %y, ptr %p) { ; CHECK-LABEL: @ashr_sub_nsw_extra_use( ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: store i32 [[SUB]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[SUB]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[SHR:%.*]] = ashr i32 [[SUB]], 31 ; CHECK-NEXT: ret i32 [[SHR]] ; %sub = sub nsw i32 %x, %y - store i32 %sub, i32* %p + store i32 %sub, ptr %p %shr = ashr i32 %sub, 31 ret i32 %shr } diff --git a/llvm/test/Transforms/InstCombine/assume-align.ll b/llvm/test/Transforms/InstCombine/assume-align.ll index b6e66c23ee03c..80da69b2da3ed 100644 --- a/llvm/test/Transforms/InstCombine/assume-align.ll +++ b/llvm/test/Transforms/InstCombine/assume-align.ll @@ -3,43 +3,41 @@ declare void @llvm.assume(i1 noundef) -define void @f1(i8* %a) { +define void @f1(ptr %a) { ; CHECK-LABEL: @f1( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds i8, i8* [[A:%.*]], i64 4 -; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint i8* [[PTR]] to i64 +; CHECK-NEXT: [[PTR:%.*]] = getelementptr inbounds i8, ptr [[A:%.*]], i64 4 +; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[PTR]] to i64 ; CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 3 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 0 ; CHECK-NEXT: br i1 [[TMP2]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: -; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[PTR]], i64 4) ] -; CHECK-NEXT: [[TMP3:%.*]] = bitcast i8* [[PTR]] to i32* -; CHECK-NEXT: store i32 4, i32* [[TMP3]], align 4 +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[PTR]], i64 4) ] +; CHECK-NEXT: store i32 4, ptr [[PTR]], align 4 ; CHECK-NEXT: br label [[IF_END]] ; CHECK: if.end: ; CHECK-NEXT: ret void ; entry: - %ptr = getelementptr inbounds i8, i8* %a, i64 4 - %0 = ptrtoint i8* %ptr to i64 + %ptr = getelementptr inbounds i8, ptr %a, i64 4 + %0 = ptrtoint ptr %ptr to i64 %1 = and i64 %0, 3 %2 = icmp eq i64 %1, 0 br i1 %2, label %if.then, label %if.end if.then: ; preds = %entry - call void @llvm.assume(i1 true) [ "align"(i8* %ptr, i64 4) ] - %3 = ptrtoint i8* %ptr to i64 + call void @llvm.assume(i1 true) [ "align"(ptr %ptr, i64 4) ] + %3 = ptrtoint ptr %ptr to i64 %4 = and i64 %3, 3 %5 = icmp eq i64 %4, 0 br i1 %5, label %if.then1, label %if.else1 if.then1: ; preds = %if.then - %6 = bitcast i8* %ptr to i32* - store i32 4, i32* %6, align 4 + store i32 4, ptr %ptr, align 4 br label %if.end if.else1: ; preds = %if.then - store i8 1, i8* %ptr, align 1 + store i8 1, ptr %ptr, align 1 br label %if.end if.end: ; preds = %if.then1, %if.else1, %entry @@ -48,56 +46,54 @@ if.end: ; preds = %if.then1, %if.else1 ; TODO: We could fold away the branch "br i1 %3, ..." by either using a GEP or make getKnowledgeValidInContext aware the alignment bundle offset, and the improvement of value tracking of GEP. -define void @f2(i8* %a) { +define void @f2(ptr %a) { ; CHECK-LABEL: @f2( ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[A:%.*]], i64 32, i32 24) ] -; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, i8* [[A]], i64 8 -; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i8* [[TMP0]] to i64 +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[A:%.*]], i64 32, i32 24) ] +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 8 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64 ; CHECK-NEXT: [[TMP2:%.*]] = and i64 [[TMP1]], 8 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i64 [[TMP2]], 0 ; CHECK-NEXT: br i1 [[TMP3]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP0]] to i64* -; CHECK-NEXT: store i64 16, i64* [[TMP4]], align 8 +; CHECK-NEXT: store i64 16, ptr [[TMP0]], align 8 ; CHECK-NEXT: br label [[IF_END:%.*]] ; CHECK: if.else: -; CHECK-NEXT: store i8 1, i8* [[TMP0]], align 8 +; CHECK-NEXT: store i8 1, ptr [[TMP0]], align 8 ; CHECK-NEXT: br label [[IF_END]] ; CHECK: if.end: ; CHECK-NEXT: ret void ; entry: - call void @llvm.assume(i1 true) [ "align"(i8* %a, i64 32, i32 24) ] - %0 = getelementptr inbounds i8, i8* %a, i64 8 - %1 = ptrtoint i8* %0 to i64 + call void @llvm.assume(i1 true) [ "align"(ptr %a, i64 32, i32 24) ] + %0 = getelementptr inbounds i8, ptr %a, i64 8 + %1 = ptrtoint ptr %0 to i64 %2 = and i64 %1, 15 %3 = icmp eq i64 %2, 0 br i1 %3, label %if.then, label %if.else if.then: ; preds = %entry - %4 = bitcast i8* %0 to i64* - store i64 16, i64* %4, align 4 + store i64 16, ptr %0, align 4 br label %if.end if.else: ; preds = %entry - store i8 1, i8* %0, align 1 + store i8 1, ptr %0, align 1 br label %if.end if.end: ; preds = %if.else, %if.then ret void } -define void @f3(i64 %a, i8* %b) { +define void @f3(i64 %a, ptr %b) { ; CHECK-LABEL: @f3( -; CHECK-NEXT: [[C:%.*]] = ptrtoint i8* [[B:%.*]] to i64 -; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[B]], i64 4294967296) ] +; CHECK-NEXT: [[C:%.*]] = ptrtoint ptr [[B:%.*]] to i64 +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[B]], i64 4294967296) ] ; CHECK-NEXT: [[D:%.*]] = add i64 [[C]], [[A:%.*]] ; CHECK-NEXT: call void @g(i64 [[D]]) ; CHECK-NEXT: ret void ; - %c = ptrtoint i8* %b to i64 - call void @llvm.assume(i1 true) [ "align"(i8* %b, i64 4294967296) ] + %c = ptrtoint ptr %b to i64 + call void @llvm.assume(i1 true) [ "align"(ptr %b, i64 4294967296) ] %d = add i64 %a, %c call void @g(i64 %d) ret void @@ -105,24 +101,24 @@ define void @f3(i64 %a, i8* %b) { declare void @g(i64) -define i8 @assume_align_zero(i8* %p) { +define i8 @assume_align_zero(ptr %p) { ; CHECK-LABEL: @assume_align_zero( -; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[P:%.*]], i64 0) ] -; CHECK-NEXT: [[V:%.*]] = load i8, i8* [[P]], align 1 +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P:%.*]], i64 0) ] +; CHECK-NEXT: [[V:%.*]] = load i8, ptr [[P]], align 1 ; CHECK-NEXT: ret i8 [[V]] ; - call void @llvm.assume(i1 true) [ "align"(i8* %p, i64 0) ] - %v = load i8, i8* %p + call void @llvm.assume(i1 true) [ "align"(ptr %p, i64 0) ] + %v = load i8, ptr %p ret i8 %v } -define i8 @assume_align_non_pow2(i8* %p) { +define i8 @assume_align_non_pow2(ptr %p) { ; CHECK-LABEL: @assume_align_non_pow2( -; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[P:%.*]], i64 123) ] -; CHECK-NEXT: [[V:%.*]] = load i8, i8* [[P]], align 1 +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P:%.*]], i64 123) ] +; CHECK-NEXT: [[V:%.*]] = load i8, ptr [[P]], align 1 ; CHECK-NEXT: ret i8 [[V]] ; - call void @llvm.assume(i1 true) [ "align"(i8* %p, i64 123) ] - %v = load i8, i8* %p + call void @llvm.assume(i1 true) [ "align"(ptr %p, i64 123) ] + %v = load i8, ptr %p ret i8 %v } diff --git a/llvm/test/Transforms/InstCombine/assume-icmp-null-select.ll b/llvm/test/Transforms/InstCombine/assume-icmp-null-select.ll index de6563802b73b..65d2ee65a8874 100644 --- a/llvm/test/Transforms/InstCombine/assume-icmp-null-select.ll +++ b/llvm/test/Transforms/InstCombine/assume-icmp-null-select.ll @@ -3,49 +3,43 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -define i8* @example(i8* dereferenceable(24) %x) { +define ptr @example(ptr dereferenceable(24) %x) { ; CHECK-LABEL: @example( -; CHECK-NEXT: [[X2:%.*]] = bitcast i8* [[X:%.*]] to {}** -; CHECK-NEXT: [[Y:%.*]] = load {}*, {}** [[X2]], align 8 -; CHECK-NEXT: [[Y_IS_NULL:%.*]] = icmp ne {}* [[Y]], null +; CHECK-NEXT: [[Y:%.*]] = load ptr, ptr [[X:%.*]], align 8 +; CHECK-NEXT: [[Y_IS_NULL:%.*]] = icmp ne ptr [[Y]], null ; CHECK-NEXT: call void @llvm.assume(i1 [[Y_IS_NULL]]) -; CHECK-NEXT: ret i8* [[X]] +; CHECK-NEXT: ret ptr [[X]] ; - %x2 = bitcast i8* %x to {}** - %y = load {}*, {}** %x2, align 8 - %y_is_null = icmp eq {}* %y, null + %y = load ptr, ptr %x, align 8 + %y_is_null = icmp eq ptr %y, null - %x0 = getelementptr inbounds i8, i8* %x, i64 0 - %res = select i1 %y_is_null, i8* null, i8* %x0 + %res = select i1 %y_is_null, ptr null, ptr %x - %nonnull = icmp ne i8* %res, null + %nonnull = icmp ne ptr %res, null call void @llvm.assume(i1 %nonnull) - ret i8* %res + ret ptr %res } -; TODO: this should be folded to `ret i8* %x` as well. -define i8* @example2(i8* %x) { +; TODO: this should be folded to `ret ptr %x` as well. +define ptr @example2(ptr %x) { ; CHECK-LABEL: @example2( -; CHECK-NEXT: [[X2:%.*]] = bitcast i8* [[X:%.*]] to {}** -; CHECK-NEXT: [[Y:%.*]] = load {}*, {}** [[X2]], align 8 -; CHECK-NEXT: [[Y_IS_NULL:%.*]] = icmp eq {}* [[Y]], null -; CHECK-NEXT: [[RES:%.*]] = select i1 [[Y_IS_NULL]], i8* null, i8* [[X]] -; CHECK-NEXT: [[NONNULL:%.*]] = icmp ne i8* [[RES]], null +; CHECK-NEXT: [[Y:%.*]] = load ptr, ptr [[X:%.*]], align 8 +; CHECK-NEXT: [[Y_IS_NULL:%.*]] = icmp eq ptr [[Y]], null +; CHECK-NEXT: [[RES:%.*]] = select i1 [[Y_IS_NULL]], ptr null, ptr [[X]] +; CHECK-NEXT: [[NONNULL:%.*]] = icmp ne ptr [[RES]], null ; CHECK-NEXT: call void @llvm.assume(i1 [[NONNULL]]) -; CHECK-NEXT: ret i8* [[RES]] +; CHECK-NEXT: ret ptr [[RES]] ; - %x2 = bitcast i8* %x to {}** - %y = load {}*, {}** %x2, align 8 - %y_is_null = icmp eq {}* %y, null + %y = load ptr, ptr %x, align 8 + %y_is_null = icmp eq ptr %y, null - %x0 = getelementptr inbounds i8, i8* %x, i64 0 - %res = select i1 %y_is_null, i8* null, i8* %x0 + %res = select i1 %y_is_null, ptr null, ptr %x - %nonnull = icmp ne i8* %res, null + %nonnull = icmp ne ptr %res, null call void @llvm.assume(i1 %nonnull) - ret i8* %res + ret ptr %res } declare void @llvm.assume(i1) diff --git a/llvm/test/Transforms/InstCombine/assume-loop-align.ll b/llvm/test/Transforms/InstCombine/assume-loop-align.ll index 55b17ad56fa17..f55ae0d32a0a9 100644 --- a/llvm/test/Transforms/InstCombine/assume-loop-align.ll +++ b/llvm/test/Transforms/InstCombine/assume-loop-align.ll @@ -7,25 +7,25 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind uwtable -define void @foo(i32* %a, i32* %b) #0 { +define void @foo(ptr %a, ptr %b) #0 { ; CHECK-LABEL: @foo( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i32* [[A:%.*]] to i64 +; CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[A:%.*]] to i64 ; CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 63 ; CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]]) -; CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i32* [[B:%.*]] to i64 +; CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint ptr [[B:%.*]] to i64 ; CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], 63 ; CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND3]]) ; CHECK-NEXT: br label [[FOR_BODY:%.*]] ; CHECK: for.body: ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 [[INDVARS_IV]] -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[ARRAYIDX]], align 64 +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 64 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], 1 -; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i32, i32* [[A]], i64 [[INDVARS_IV]] -; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX5]], align 64 +; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INDVARS_IV]] +; CHECK-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX5]], align 64 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 16 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i32 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP1]], 1648 @@ -34,11 +34,11 @@ define void @foo(i32* %a, i32* %b) #0 { ; CHECK-NEXT: ret void ; entry: - %ptrint = ptrtoint i32* %a to i64 + %ptrint = ptrtoint ptr %a to i64 %maskedptr = and i64 %ptrint, 63 %maskcond = icmp eq i64 %maskedptr, 0 tail call void @llvm.assume(i1 %maskcond) - %ptrint1 = ptrtoint i32* %b to i64 + %ptrint1 = ptrtoint ptr %b to i64 %maskedptr2 = and i64 %ptrint1, 63 %maskcond3 = icmp eq i64 %maskedptr2, 0 tail call void @llvm.assume(i1 %maskcond3) @@ -47,11 +47,11 @@ entry: for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv - %0 = load i32, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, ptr %b, i64 %indvars.iv + %0 = load i32, ptr %arrayidx, align 4 %add = add nsw i32 %0, 1 - %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv - store i32 %add, i32* %arrayidx5, align 4 + %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv + store i32 %add, ptr %arrayidx5, align 4 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 16 %1 = trunc i64 %indvars.iv.next to i32 %cmp = icmp slt i32 %1, 1648 diff --git a/llvm/test/Transforms/InstCombine/assume-redundant.ll b/llvm/test/Transforms/InstCombine/assume-redundant.ll index 4bdbcc8d086aa..869f06a05bd39 100644 --- a/llvm/test/Transforms/InstCombine/assume-redundant.ll +++ b/llvm/test/Transforms/InstCombine/assume-redundant.ll @@ -5,19 +5,18 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -%struct.s = type { double* } +%struct.s = type { ptr } ; Function Attrs: nounwind uwtable -define void @_Z3fooR1s(%struct.s* nocapture readonly dereferenceable(8) %x) #0 { +define void @_Z3fooR1s(ptr nocapture readonly dereferenceable(8) %x) #0 { ; CHECK-LABEL: @_Z3fooR1s ; CHECK: call void @llvm.assume ; CHECK-NOT: call void @llvm.assume entry: - %a = getelementptr inbounds %struct.s, %struct.s* %x, i64 0, i32 0 - %0 = load double*, double** %a, align 8 - %ptrint = ptrtoint double* %0 to i64 + %0 = load ptr, ptr %x, align 8 + %ptrint = ptrtoint ptr %0 to i64 %maskedptr = and i64 %ptrint, 31 %maskcond = icmp eq i64 %maskedptr, 0 br label %for.body @@ -25,20 +24,20 @@ entry: for.body: ; preds = %for.body, %entry %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.1, %for.body ] tail call void @llvm.assume(i1 %maskcond) - %arrayidx = getelementptr inbounds double, double* %0, i64 %indvars.iv - %1 = load double, double* %arrayidx, align 16 + %arrayidx = getelementptr inbounds double, ptr %0, i64 %indvars.iv + %1 = load double, ptr %arrayidx, align 16 %add = fadd double %1, 1.000000e+00 tail call void @llvm.assume(i1 %maskcond) %mul = fmul double %add, 2.000000e+00 - store double %mul, double* %arrayidx, align 16 + store double %mul, ptr %arrayidx, align 16 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 tail call void @llvm.assume(i1 %maskcond) - %arrayidx.1 = getelementptr inbounds double, double* %0, i64 %indvars.iv.next - %2 = load double, double* %arrayidx.1, align 8 + %arrayidx.1 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next + %2 = load double, ptr %arrayidx.1, align 8 %add.1 = fadd double %2, 1.000000e+00 tail call void @llvm.assume(i1 %maskcond) %mul.1 = fmul double %add.1, 2.000000e+00 - store double %mul.1, double* %arrayidx.1, align 8 + store double %mul.1, ptr %arrayidx.1, align 8 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.next, 1 %exitcond.1 = icmp eq i64 %indvars.iv.next, 1599 br i1 %exitcond.1, label %for.end, label %for.body @@ -47,14 +46,14 @@ for.end: ; preds = %for.body ret void } -declare align 8 i8* @get() +declare align 8 ptr @get() ; Check that redundant align assume is removed ; CHECK-LABEL: @test ; CHECK-NOT: call void @llvm.assume define void @test1() { - %p = call align 8 i8* @get() - %ptrint = ptrtoint i8* %p to i64 + %p = call align 8 ptr @get() + %ptrint = ptrtoint ptr %p to i64 %maskedptr = and i64 %ptrint, 7 %maskcond = icmp eq i64 %maskedptr, 0 call void @llvm.assume(i1 %maskcond) @@ -66,7 +65,7 @@ define void @test1() { ; CHECK-NOT: call void @llvm.assume define void @test3() { %p = alloca i8, align 8 - %ptrint = ptrtoint i8* %p to i64 + %ptrint = ptrtoint ptr %p to i64 %maskedptr = and i64 %ptrint, 7 %maskcond = icmp eq i64 %maskedptr, 0 call void @llvm.assume(i1 %maskcond) diff --git a/llvm/test/Transforms/InstCombine/assume.ll b/llvm/test/Transforms/InstCombine/assume.ll index c3ae342efca79..d6490dbd2d365 100644 --- a/llvm/test/Transforms/InstCombine/assume.ll +++ b/llvm/test/Transforms/InstCombine/assume.ll @@ -10,22 +10,22 @@ declare void @llvm.assume(i1) #1 ; Check that the alignment has been upgraded and that the assume has not ; been removed: -define i32 @foo1(i32* %a) #0 { +define i32 @foo1(ptr %a) #0 { ; DEFAULT-LABEL: @foo1( -; DEFAULT-NEXT: [[T0:%.*]] = load i32, i32* [[A:%.*]], align 32 -; DEFAULT-NEXT: [[PTRINT:%.*]] = ptrtoint i32* [[A]] to i64 +; DEFAULT-NEXT: [[T0:%.*]] = load i32, ptr [[A:%.*]], align 32 +; DEFAULT-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64 ; DEFAULT-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 ; DEFAULT-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 ; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]]) ; DEFAULT-NEXT: ret i32 [[T0]] ; ; BUNDLES-LABEL: @foo1( -; BUNDLES-NEXT: [[T0:%.*]] = load i32, i32* [[A:%.*]], align 32 -; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(i32* [[A]], i64 32) ] +; BUNDLES-NEXT: [[T0:%.*]] = load i32, ptr [[A:%.*]], align 32 +; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[A]], i64 32) ] ; BUNDLES-NEXT: ret i32 [[T0]] ; - %t0 = load i32, i32* %a, align 4 - %ptrint = ptrtoint i32* %a to i64 + %t0 = load i32, ptr %a, align 4 + %ptrint = ptrtoint ptr %a to i64 %maskedptr = and i64 %ptrint, 31 %maskcond = icmp eq i64 %maskedptr, 0 tail call void @llvm.assume(i1 %maskcond) @@ -34,25 +34,25 @@ define i32 @foo1(i32* %a) #0 { ; Same check as in @foo1, but make sure it works if the assume is first too. -define i32 @foo2(i32* %a) #0 { +define i32 @foo2(ptr %a) #0 { ; DEFAULT-LABEL: @foo2( -; DEFAULT-NEXT: [[PTRINT:%.*]] = ptrtoint i32* [[A:%.*]] to i64 +; DEFAULT-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[A:%.*]] to i64 ; DEFAULT-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 ; DEFAULT-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 ; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]]) -; DEFAULT-NEXT: [[T0:%.*]] = load i32, i32* [[A]], align 32 +; DEFAULT-NEXT: [[T0:%.*]] = load i32, ptr [[A]], align 32 ; DEFAULT-NEXT: ret i32 [[T0]] ; ; BUNDLES-LABEL: @foo2( -; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(i32* [[A:%.*]], i64 32) ] -; BUNDLES-NEXT: [[T0:%.*]] = load i32, i32* [[A]], align 32 +; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[A:%.*]], i64 32) ] +; BUNDLES-NEXT: [[T0:%.*]] = load i32, ptr [[A]], align 32 ; BUNDLES-NEXT: ret i32 [[T0]] ; - %ptrint = ptrtoint i32* %a to i64 + %ptrint = ptrtoint ptr %a to i64 %maskedptr = and i64 %ptrint, 31 %maskcond = icmp eq i64 %maskedptr, 0 tail call void @llvm.assume(i1 %maskcond) - %t0 = load i32, i32* %a, align 4 + %t0 = load i32, ptr %a, align 4 ret i32 %t0 } @@ -238,56 +238,56 @@ define i1 @assume_not(i1 %cond) { ret i1 %cond } -declare void @escape(i32* %a) +declare void @escape(ptr %a) ; Canonicalize a nonnull assumption on a load into metadata form. -define i32 @bundle1(i32* %P) { +define i32 @bundle1(ptr %P) { ; CHECK-LABEL: @bundle1( -; CHECK-NEXT: tail call void @llvm.assume(i1 true) [ "nonnull"(i32* [[P:%.*]]) ] -; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[P]], align 4 +; CHECK-NEXT: tail call void @llvm.assume(i1 true) [ "nonnull"(ptr [[P:%.*]]) ] +; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[P]], align 4 ; CHECK-NEXT: ret i32 [[LOAD]] ; - tail call void @llvm.assume(i1 true) ["nonnull"(i32* %P)] - %load = load i32, i32* %P + tail call void @llvm.assume(i1 true) ["nonnull"(ptr %P)] + %load = load i32, ptr %P ret i32 %load } -define i32 @bundle2(i32* %P) { +define i32 @bundle2(ptr %P) { ; CHECK-LABEL: @bundle2( -; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[P:%.*]], align 4 +; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: ret i32 [[LOAD]] ; - tail call void @llvm.assume(i1 true) ["ignore"(i32* undef)] - %load = load i32, i32* %P + tail call void @llvm.assume(i1 true) ["ignore"(ptr undef)] + %load = load i32, ptr %P ret i32 %load } -define i1 @nonnull1(i32** %a) { +define i1 @nonnull1(ptr %a) { ; CHECK-LABEL: @nonnull1( -; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8, !nonnull !6 -; CHECK-NEXT: tail call void @escape(i32* nonnull [[LOAD]]) +; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8, !nonnull !6 +; CHECK-NEXT: tail call void @escape(ptr nonnull [[LOAD]]) ; CHECK-NEXT: ret i1 false ; - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null tail call void @llvm.assume(i1 %cmp) - tail call void @escape(i32* %load) - %rval = icmp eq i32* %load, null + tail call void @escape(ptr %load) + %rval = icmp eq ptr %load, null ret i1 %rval } ; Make sure the above canonicalization applies only ; to pointer types. Doing otherwise would be illegal. -define i1 @nonnull2(i32* %a) { +define i1 @nonnull2(ptr %a) { ; CHECK-LABEL: @nonnull2( -; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[A:%.*]], align 4 +; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr [[A:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[LOAD]], 0 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: ret i1 false ; - %load = load i32, i32* %a + %load = load i32, ptr %a %cmp = icmp ne i32 %load, 0 tail call void @llvm.assume(i1 %cmp) %rval = icmp eq i32 %load, 0 @@ -297,18 +297,18 @@ define i1 @nonnull2(i32* %a) { ; Make sure the above canonicalization does not trigger ; if the assume is control dependent on something else -define i1 @nonnull3(i32** %a, i1 %control) { +define i1 @nonnull3(ptr %a, i1 %control) { ; FIXME: in the BUNDLES version we could duplicate the load and keep the assume nonnull. ; DEFAULT-LABEL: @nonnull3( ; DEFAULT-NEXT: entry: -; DEFAULT-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null +; DEFAULT-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null ; DEFAULT-NEXT: br i1 [[CONTROL:%.*]], label [[TAKEN:%.*]], label [[NOT_TAKEN:%.*]] ; DEFAULT: taken: ; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; DEFAULT-NEXT: ret i1 false ; DEFAULT: not_taken: -; DEFAULT-NEXT: [[RVAL_2:%.*]] = icmp sgt i32* [[LOAD]], null +; DEFAULT-NEXT: [[RVAL_2:%.*]] = icmp sgt ptr [[LOAD]], null ; DEFAULT-NEXT: ret i1 [[RVAL_2]] ; ; BUNDLES-LABEL: @nonnull3( @@ -317,20 +317,20 @@ define i1 @nonnull3(i32** %a, i1 %control) { ; BUNDLES: taken: ; BUNDLES-NEXT: ret i1 false ; BUNDLES: not_taken: -; BUNDLES-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; BUNDLES-NEXT: [[RVAL_2:%.*]] = icmp sgt i32* [[LOAD]], null +; BUNDLES-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; BUNDLES-NEXT: [[RVAL_2:%.*]] = icmp sgt ptr [[LOAD]], null ; BUNDLES-NEXT: ret i1 [[RVAL_2]] ; entry: - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null br i1 %control, label %taken, label %not_taken taken: tail call void @llvm.assume(i1 %cmp) - %rval = icmp eq i32* %load, null + %rval = icmp eq ptr %load, null ret i1 %rval not_taken: - %rval.2 = icmp sgt i32* %load, null + %rval.2 = icmp sgt ptr %load, null ret i1 %rval.2 } @@ -338,43 +338,43 @@ not_taken: ; if the path from the load to the assume is potentially ; interrupted by an exception being thrown -define i1 @nonnull4(i32** %a) { +define i1 @nonnull4(ptr %a) { ; DEFAULT-LABEL: @nonnull4( -; DEFAULT-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; DEFAULT-NEXT: tail call void @escape(i32* [[LOAD]]) -; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null +; DEFAULT-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; DEFAULT-NEXT: tail call void @escape(ptr [[LOAD]]) +; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null ; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; DEFAULT-NEXT: ret i1 false ; ; BUNDLES-LABEL: @nonnull4( -; BUNDLES-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; BUNDLES-NEXT: tail call void @escape(i32* [[LOAD]]) -; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i32* [[LOAD]]) ] +; BUNDLES-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; BUNDLES-NEXT: tail call void @escape(ptr [[LOAD]]) +; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[LOAD]]) ] ; BUNDLES-NEXT: ret i1 false ; - %load = load i32*, i32** %a + %load = load ptr, ptr %a ;; This call may throw! - tail call void @escape(i32* %load) - %cmp = icmp ne i32* %load, null + tail call void @escape(ptr %load) + %cmp = icmp ne ptr %load, null tail call void @llvm.assume(i1 %cmp) - %rval = icmp eq i32* %load, null + %rval = icmp eq ptr %load, null ret i1 %rval } -define i1 @nonnull5(i32** %a) { +define i1 @nonnull5(ptr %a) { ; CHECK-LABEL: @nonnull5( -; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; CHECK-NEXT: tail call void @escape(i32* [[LOAD]]) -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32* [[LOAD]], null +; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; CHECK-NEXT: tail call void @escape(ptr [[LOAD]]) +; CHECK-NEXT: [[CMP:%.*]] = icmp slt ptr [[LOAD]], null ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: ret i1 false ; - %load = load i32*, i32** %a + %load = load ptr, ptr %a ;; This call may throw! - tail call void @escape(i32* %load) - %integral = ptrtoint i32* %load to i64 + tail call void @escape(ptr %load) + %integral = ptrtoint ptr %load to i64 %cmp = icmp slt i64 %integral, 0 tail call void @llvm.assume(i1 %cmp) ; %load has at least highest bit set - %rval = icmp eq i32* %load, null + %rval = icmp eq ptr %load, null ret i1 %rval } @@ -443,17 +443,17 @@ define i32 @PR40940(<4 x i8> %x) { ret i32 %t2 } -define i1 @nonnull3A(i32** %a, i1 %control) { +define i1 @nonnull3A(ptr %a, i1 %control) { ; DEFAULT-LABEL: @nonnull3A( ; DEFAULT-NEXT: entry: -; DEFAULT-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 +; DEFAULT-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 ; DEFAULT-NEXT: br i1 [[CONTROL:%.*]], label [[TAKEN:%.*]], label [[NOT_TAKEN:%.*]] ; DEFAULT: taken: -; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null +; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null ; DEFAULT-NEXT: call void @llvm.assume(i1 [[CMP]]) ; DEFAULT-NEXT: ret i1 true ; DEFAULT: not_taken: -; DEFAULT-NEXT: [[RVAL_2:%.*]] = icmp sgt i32* [[LOAD]], null +; DEFAULT-NEXT: [[RVAL_2:%.*]] = icmp sgt ptr [[LOAD]], null ; DEFAULT-NEXT: ret i1 [[RVAL_2]] ; ; BUNDLES-LABEL: @nonnull3A( @@ -462,56 +462,56 @@ define i1 @nonnull3A(i32** %a, i1 %control) { ; BUNDLES: taken: ; BUNDLES-NEXT: ret i1 true ; BUNDLES: not_taken: -; BUNDLES-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; BUNDLES-NEXT: [[RVAL_2:%.*]] = icmp sgt i32* [[LOAD]], null +; BUNDLES-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; BUNDLES-NEXT: [[RVAL_2:%.*]] = icmp sgt ptr [[LOAD]], null ; BUNDLES-NEXT: ret i1 [[RVAL_2]] ; entry: - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null br i1 %control, label %taken, label %not_taken taken: call void @llvm.assume(i1 %cmp) ret i1 %cmp not_taken: call void @llvm.assume(i1 %cmp) - %rval.2 = icmp sgt i32* %load, null + %rval.2 = icmp sgt ptr %load, null ret i1 %rval.2 } -define i1 @nonnull3B(i32** %a, i1 %control) { +define i1 @nonnull3B(ptr %a, i1 %control) { ; CHECK-LABEL: @nonnull3B( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[CONTROL:%.*]], label [[TAKEN:%.*]], label [[NOT_TAKEN:%.*]] ; CHECK: taken: -; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null -; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) [ "nonnull"(i32* [[LOAD]]) ] +; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null +; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) [ "nonnull"(ptr [[LOAD]]) ] ; CHECK-NEXT: ret i1 true ; CHECK: not_taken: ; CHECK-NEXT: ret i1 [[CONTROL]] ; entry: - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null br i1 %control, label %taken, label %not_taken taken: - call void @llvm.assume(i1 %cmp) ["nonnull"(i32* %load)] + call void @llvm.assume(i1 %cmp) ["nonnull"(ptr %load)] ret i1 %cmp not_taken: - call void @llvm.assume(i1 %cmp) ["nonnull"(i32* %load)] + call void @llvm.assume(i1 %cmp) ["nonnull"(ptr %load)] ret i1 %control } declare i1 @tmp1(i1) -define i1 @nonnull3C(i32** %a, i1 %control) { +define i1 @nonnull3C(ptr %a, i1 %control) { ; CHECK-LABEL: @nonnull3C( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[CONTROL:%.*]], label [[TAKEN:%.*]], label [[NOT_TAKEN:%.*]] ; CHECK: taken: -; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null +; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null ; CHECK-NEXT: [[CMP2:%.*]] = call i1 @tmp1(i1 [[CMP]]) ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: exit: @@ -520,28 +520,28 @@ define i1 @nonnull3C(i32** %a, i1 %control) { ; CHECK-NEXT: ret i1 [[CONTROL]] ; entry: - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null br i1 %control, label %taken, label %not_taken taken: %cmp2 = call i1 @tmp1(i1 %cmp) br label %exit exit: ; FIXME: this shouldn't be dropped because it is still dominated by the new position of %load - call void @llvm.assume(i1 %cmp) ["nonnull"(i32* %load)] + call void @llvm.assume(i1 %cmp) ["nonnull"(ptr %load)] ret i1 %cmp2 not_taken: call void @llvm.assume(i1 %cmp) ret i1 %control } -define i1 @nonnull3D(i32** %a, i1 %control) { +define i1 @nonnull3D(ptr %a, i1 %control) { ; CHECK-LABEL: @nonnull3D( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[CONTROL:%.*]], label [[TAKEN:%.*]], label [[NOT_TAKEN:%.*]] ; CHECK: taken: -; CHECK-NEXT: [[LOAD:%.*]] = load i32*, i32** [[A:%.*]], align 8 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32* [[LOAD]], null +; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[A:%.*]], align 8 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[LOAD]], null ; CHECK-NEXT: [[CMP2:%.*]] = call i1 @tmp1(i1 [[CMP]]) ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: exit: @@ -550,8 +550,8 @@ define i1 @nonnull3D(i32** %a, i1 %control) { ; CHECK-NEXT: ret i1 [[CONTROL]] ; entry: - %load = load i32*, i32** %a - %cmp = icmp ne i32* %load, null + %load = load ptr, ptr %a + %cmp = icmp ne ptr %load, null br i1 %control, label %taken, label %not_taken taken: %cmp2 = call i1 @tmp1(i1 %cmp) @@ -559,7 +559,7 @@ taken: exit: ret i1 %cmp2 not_taken: - call void @llvm.assume(i1 %cmp) ["nonnull"(i32* %load)] + call void @llvm.assume(i1 %cmp) ["nonnull"(ptr %load)] ret i1 %control } @@ -578,12 +578,12 @@ define void @always_true_assumption() { define i64 @PR31809() { ; CHECK-LABEL: @PR31809( ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 -; CHECK-NEXT: [[T1:%.*]] = ptrtoint i32* [[A]] to i64 +; CHECK-NEXT: [[T1:%.*]] = ptrtoint ptr [[A]] to i64 ; CHECK-NEXT: call void @llvm.assume(i1 false) ; CHECK-NEXT: ret i64 [[T1]] ; %a = alloca i32 - %t1 = ptrtoint i32* %a to i64 + %t1 = ptrtoint ptr %a to i64 %cond = icmp eq i64 %t1, 3 call void @llvm.assume(i1 %cond) ret i64 %t1 @@ -700,7 +700,7 @@ exit: unreachable } -define i32 @unreachable_assumes_and_store(i32 %x, i32 %y, i32* %p) { +define i32 @unreachable_assumes_and_store(i32 %x, i32 %y, ptr %p) { ; CHECK-LABEL: @unreachable_assumes_and_store( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP0:%.*]] = icmp sgt i32 [[X:%.*]], 1 @@ -736,11 +736,11 @@ exit: tail call void @llvm.assume(i1 %cmp4) %cmp5 = icmp ugt i32 %y, 42 tail call void @llvm.assume(i1 %cmp5) - store i32 %x, i32* %p + store i32 %x, ptr %p unreachable } -define i32 @unreachable_assumes_and_store_logical(i32 %x, i32 %y, i32* %p) { +define i32 @unreachable_assumes_and_store_logical(i32 %x, i32 %y, ptr %p) { ; CHECK-LABEL: @unreachable_assumes_and_store_logical( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP0:%.*]] = icmp sgt i32 [[X:%.*]], 1 @@ -776,24 +776,22 @@ exit: tail call void @llvm.assume(i1 %cmp4) %cmp5 = icmp ugt i32 %y, 42 tail call void @llvm.assume(i1 %cmp5) - store i32 %x, i32* %p + store i32 %x, ptr %p unreachable } -define void @canonicalize_assume(i32* %0) { +define void @canonicalize_assume(ptr %0) { ; DEFAULT-LABEL: @canonicalize_assume( -; DEFAULT-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP0:%.*]], i64 2 -; DEFAULT-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to i8* -; DEFAULT-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* [[TMP3]], i64 16) ] +; DEFAULT-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP0:%.*]], i64 2 +; DEFAULT-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP2]], i64 16) ] ; DEFAULT-NEXT: ret void ; ; BUNDLES-LABEL: @canonicalize_assume( -; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(i32* [[TMP0:%.*]], i64 8) ] +; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP0:%.*]], i64 8) ] ; BUNDLES-NEXT: ret void ; - %2 = getelementptr inbounds i32, i32* %0, i64 2 - %3 = bitcast i32* %2 to i8* - call void @llvm.assume(i1 true) [ "align"(i8* %3, i64 16) ] + %2 = getelementptr inbounds i32, ptr %0, i64 2 + call void @llvm.assume(i1 true) [ "align"(ptr %2, i64 16) ] ret void } diff --git a/llvm/test/Transforms/InstCombine/atomic.ll b/llvm/test/Transforms/InstCombine/atomic.ll index e3afffeb9b4a8..7842fdf3d2de5 100644 --- a/llvm/test/Transforms/InstCombine/atomic.ll +++ b/llvm/test/Transforms/InstCombine/atomic.ll @@ -6,27 +6,27 @@ target triple = "x86_64-apple-macosx10.7.0" ; Check transforms involving atomic operations -define i32 @test1(i32* %p) { +define i32 @test1(ptr %p) { ; CHECK-LABEL: @test1( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] seq_cst, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] seq_cst, align 4 ; CHECK-NEXT: [[Z:%.*]] = shl i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p seq_cst, align 4 - %y = load i32, i32* %p, align 4 + %x = load atomic i32, ptr %p seq_cst, align 4 + %y = load i32, ptr %p, align 4 %z = add i32 %x, %y ret i32 %z } -define i32 @test2(i32* %p) { +define i32 @test2(ptr %p) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[X:%.*]] = load volatile i32, i32* [[P:%.*]], align 4 -; CHECK-NEXT: [[Y:%.*]] = load volatile i32, i32* [[P]], align 4 +; CHECK-NEXT: [[X:%.*]] = load volatile i32, ptr [[P:%.*]], align 4 +; CHECK-NEXT: [[Y:%.*]] = load volatile i32, ptr [[P]], align 4 ; CHECK-NEXT: [[Z:%.*]] = add i32 [[X]], [[Y]] ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load volatile i32, i32* %p, align 4 - %y = load volatile i32, i32* %p, align 4 + %x = load volatile i32, ptr %p, align 4 + %y = load volatile i32, ptr %p, align 4 %z = add i32 %x, %y ret i32 %z } @@ -34,27 +34,27 @@ define i32 @test2(i32* %p) { ; The exact semantics of mixing volatile and non-volatile on the same ; memory location are a bit unclear, but conservatively, we know we don't ; want to remove the volatile. -define i32 @test3(i32* %p) { +define i32 @test3(ptr %p) { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[X:%.*]] = load volatile i32, i32* [[P:%.*]], align 4 +; CHECK-NEXT: [[X:%.*]] = load volatile i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[Z:%.*]] = shl i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load volatile i32, i32* %p, align 4 - %y = load i32, i32* %p, align 4 + %x = load volatile i32, ptr %p, align 4 + %y = load i32, ptr %p, align 4 %z = add i32 %x, %y ret i32 %z } ; Forwarding from a stronger ordered atomic is fine -define i32 @test4(i32* %p) { +define i32 @test4(ptr %p) { ; CHECK-LABEL: @test4( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] seq_cst, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] seq_cst, align 4 ; CHECK-NEXT: [[Z:%.*]] = shl i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p seq_cst, align 4 - %y = load atomic i32, i32* %p unordered, align 4 + %x = load atomic i32, ptr %p seq_cst, align 4 + %y = load atomic i32, ptr %p unordered, align 4 %z = add i32 %x, %y ret i32 %z } @@ -62,55 +62,55 @@ define i32 @test4(i32* %p) { ; Forwarding from a non-atomic is not. (The earlier load ; could in priciple be promoted to atomic and then forwarded, ; but we can't just drop the atomic from the load.) -define i32 @test5(i32* %p) { +define i32 @test5(ptr %p) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] unordered, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] unordered, align 4 ; CHECK-NEXT: [[Z:%.*]] = shl i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p unordered, align 4 - %y = load i32, i32* %p, align 4 + %x = load atomic i32, ptr %p unordered, align 4 + %y = load i32, ptr %p, align 4 %z = add i32 %x, %y ret i32 %z } ; Forwarding atomic to atomic is fine -define i32 @test6(i32* %p) { +define i32 @test6(ptr %p) { ; CHECK-LABEL: @test6( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] unordered, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] unordered, align 4 ; CHECK-NEXT: [[Z:%.*]] = shl i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p unordered, align 4 - %y = load atomic i32, i32* %p unordered, align 4 + %x = load atomic i32, ptr %p unordered, align 4 + %y = load atomic i32, ptr %p unordered, align 4 %z = add i32 %x, %y ret i32 %z } ; FIXME: we currently don't do anything for monotonic -define i32 @test7(i32* %p) { +define i32 @test7(ptr %p) { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] seq_cst, align 4 -; CHECK-NEXT: [[Y:%.*]] = load atomic i32, i32* [[P]] monotonic, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] seq_cst, align 4 +; CHECK-NEXT: [[Y:%.*]] = load atomic i32, ptr [[P]] monotonic, align 4 ; CHECK-NEXT: [[Z:%.*]] = add i32 [[X]], [[Y]] ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p seq_cst, align 4 - %y = load atomic i32, i32* %p monotonic, align 4 + %x = load atomic i32, ptr %p seq_cst, align 4 + %y = load atomic i32, ptr %p monotonic, align 4 %z = add i32 %x, %y ret i32 %z } ; FIXME: We could forward in racy code -define i32 @test8(i32* %p) { +define i32 @test8(ptr %p) { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[P:%.*]] seq_cst, align 4 -; CHECK-NEXT: [[Y:%.*]] = load atomic i32, i32* [[P]] acquire, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[P:%.*]] seq_cst, align 4 +; CHECK-NEXT: [[Y:%.*]] = load atomic i32, ptr [[P]] acquire, align 4 ; CHECK-NEXT: [[Z:%.*]] = add i32 [[X]], [[Y]] ; CHECK-NEXT: ret i32 [[Z]] ; - %x = load atomic i32, i32* %p seq_cst, align 4 - %y = load atomic i32, i32* %p acquire, align 4 + %x = load atomic i32, ptr %p seq_cst, align 4 + %y = load atomic i32, ptr %p acquire, align 4 %z = add i32 %x, %y ret i32 %z } @@ -119,57 +119,57 @@ define i32 @test8(i32* %p) { ; ordering imposed. define i32 @test9() { ; CHECK-LABEL: @test9( -; CHECK-NEXT: store i32 poison, i32* null, align 4294967296 +; CHECK-NEXT: store i32 poison, ptr null, align 4294967296 ; CHECK-NEXT: ret i32 poison ; - %x = load atomic i32, i32* null unordered, align 4 + %x = load atomic i32, ptr null unordered, align 4 ret i32 %x } define i32 @test9_no_null_opt() #0 { ; CHECK-LABEL: @test9_no_null_opt( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* null unordered, align 4294967296 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr null unordered, align 4294967296 ; CHECK-NEXT: ret i32 [[X]] ; - %x = load atomic i32, i32* null unordered, align 4 + %x = load atomic i32, ptr null unordered, align 4 ret i32 %x } ; FIXME: Could also fold define i32 @test10() { ; CHECK-LABEL: @test10( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* null monotonic, align 4294967296 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr null monotonic, align 4294967296 ; CHECK-NEXT: ret i32 [[X]] ; - %x = load atomic i32, i32* null monotonic, align 4 + %x = load atomic i32, ptr null monotonic, align 4 ret i32 %x } define i32 @test10_no_null_opt() #0 { ; CHECK-LABEL: @test10_no_null_opt( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* null monotonic, align 4294967296 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr null monotonic, align 4294967296 ; CHECK-NEXT: ret i32 [[X]] ; - %x = load atomic i32, i32* null monotonic, align 4 + %x = load atomic i32, ptr null monotonic, align 4 ret i32 %x } ; Would this be legal to fold? Probably? define i32 @test11() { ; CHECK-LABEL: @test11( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* null seq_cst, align 4294967296 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr null seq_cst, align 4294967296 ; CHECK-NEXT: ret i32 [[X]] ; - %x = load atomic i32, i32* null seq_cst, align 4 + %x = load atomic i32, ptr null seq_cst, align 4 ret i32 %x } define i32 @test11_no_null_opt() #0 { ; CHECK-LABEL: @test11_no_null_opt( -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* null seq_cst, align 4294967296 +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr null seq_cst, align 4294967296 ; CHECK-NEXT: ret i32 [[X]] ; - %x = load atomic i32, i32* null seq_cst, align 4 + %x = load atomic i32, ptr null seq_cst, align 4 ret i32 %x } @@ -177,57 +177,57 @@ define i32 @test11_no_null_opt() #0 { ; ordering imposed. define i32 @test12() { ; CHECK-LABEL: @test12( -; CHECK-NEXT: store atomic i32 poison, i32* null unordered, align 4294967296 +; CHECK-NEXT: store atomic i32 poison, ptr null unordered, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null unordered, align 4 + store atomic i32 0, ptr null unordered, align 4 ret i32 0 } define i32 @test12_no_null_opt() #0 { ; CHECK-LABEL: @test12_no_null_opt( -; CHECK-NEXT: store atomic i32 0, i32* null unordered, align 4294967296 +; CHECK-NEXT: store atomic i32 0, ptr null unordered, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null unordered, align 4 + store atomic i32 0, ptr null unordered, align 4 ret i32 0 } ; FIXME: Could also fold define i32 @test13() { ; CHECK-LABEL: @test13( -; CHECK-NEXT: store atomic i32 0, i32* null monotonic, align 4294967296 +; CHECK-NEXT: store atomic i32 0, ptr null monotonic, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null monotonic, align 4 + store atomic i32 0, ptr null monotonic, align 4 ret i32 0 } define i32 @test13_no_null_opt() #0 { ; CHECK-LABEL: @test13_no_null_opt( -; CHECK-NEXT: store atomic i32 0, i32* null monotonic, align 4294967296 +; CHECK-NEXT: store atomic i32 0, ptr null monotonic, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null monotonic, align 4 + store atomic i32 0, ptr null monotonic, align 4 ret i32 0 } ; Would this be legal to fold? Probably? define i32 @test14() { ; CHECK-LABEL: @test14( -; CHECK-NEXT: store atomic i32 0, i32* null seq_cst, align 4294967296 +; CHECK-NEXT: store atomic i32 0, ptr null seq_cst, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null seq_cst, align 4 + store atomic i32 0, ptr null seq_cst, align 4 ret i32 0 } define i32 @test14_no_null_opt() #0 { ; CHECK-LABEL: @test14_no_null_opt( -; CHECK-NEXT: store atomic i32 0, i32* null seq_cst, align 4294967296 +; CHECK-NEXT: store atomic i32 0, ptr null seq_cst, align 4294967296 ; CHECK-NEXT: ret i32 0 ; - store atomic i32 0, i32* null seq_cst, align 4 + store atomic i32 0, ptr null seq_cst, align 4 ret i32 0 } @@ -236,37 +236,37 @@ define i32 @test14_no_null_opt() #0 { define i32 @test15(i1 %cnd) { ; CHECK-LABEL: @test15( -; CHECK-NEXT: [[A_VAL:%.*]] = load atomic i32, i32* @a unordered, align 4 -; CHECK-NEXT: [[B_VAL:%.*]] = load atomic i32, i32* @b unordered, align 4 +; CHECK-NEXT: [[A_VAL:%.*]] = load atomic i32, ptr @a unordered, align 4 +; CHECK-NEXT: [[B_VAL:%.*]] = load atomic i32, ptr @b unordered, align 4 ; CHECK-NEXT: [[X:%.*]] = select i1 [[CND:%.*]], i32 [[A_VAL]], i32 [[B_VAL]] ; CHECK-NEXT: ret i32 [[X]] ; - %addr = select i1 %cnd, i32* @a, i32* @b - %x = load atomic i32, i32* %addr unordered, align 4 + %addr = select i1 %cnd, ptr @a, ptr @b + %x = load atomic i32, ptr %addr unordered, align 4 ret i32 %x } ; FIXME: This would be legal to transform define i32 @test16(i1 %cnd) { ; CHECK-LABEL: @test16( -; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CND:%.*]], i32* @a, i32* @b -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[ADDR]] monotonic, align 4 +; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CND:%.*]], ptr @a, ptr @b +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[ADDR]] monotonic, align 4 ; CHECK-NEXT: ret i32 [[X]] ; - %addr = select i1 %cnd, i32* @a, i32* @b - %x = load atomic i32, i32* %addr monotonic, align 4 + %addr = select i1 %cnd, ptr @a, ptr @b + %x = load atomic i32, ptr %addr monotonic, align 4 ret i32 %x } ; FIXME: This would be legal to transform define i32 @test17(i1 %cnd) { ; CHECK-LABEL: @test17( -; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CND:%.*]], i32* @a, i32* @b -; CHECK-NEXT: [[X:%.*]] = load atomic i32, i32* [[ADDR]] seq_cst, align 4 +; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CND:%.*]], ptr @a, ptr @b +; CHECK-NEXT: [[X:%.*]] = load atomic i32, ptr [[ADDR]] seq_cst, align 4 ; CHECK-NEXT: ret i32 [[X]] ; - %addr = select i1 %cnd, i32* @a, i32* @b - %x = load atomic i32, i32* %addr seq_cst, align 4 + %addr = select i1 %cnd, ptr @a, ptr @b + %x = load atomic i32, ptr %addr seq_cst, align 4 ret i32 %x } @@ -279,16 +279,16 @@ define i32 @test22(i1 %cnd) { ; CHECK-NEXT: br label [[MERGE]] ; CHECK: merge: ; CHECK-NEXT: [[STOREMERGE:%.*]] = phi i32 [ 2, [[BLOCK2]] ], [ 1, [[BLOCK1]] ] -; CHECK-NEXT: store atomic i32 [[STOREMERGE]], i32* @a unordered, align 4 +; CHECK-NEXT: store atomic i32 [[STOREMERGE]], ptr @a unordered, align 4 ; CHECK-NEXT: ret i32 0 ; br i1 %cnd, label %block1, label %block2 block1: - store atomic i32 1, i32* @a unordered, align 4 + store atomic i32 1, ptr @a unordered, align 4 br label %merge block2: - store atomic i32 2, i32* @a unordered, align 4 + store atomic i32 2, ptr @a unordered, align 4 br label %merge merge: @@ -300,10 +300,10 @@ define i32 @test23(i1 %cnd) { ; CHECK-LABEL: @test23( ; CHECK-NEXT: br i1 [[CND:%.*]], label [[BLOCK1:%.*]], label [[BLOCK2:%.*]] ; CHECK: block1: -; CHECK-NEXT: store atomic i32 1, i32* @a monotonic, align 4 +; CHECK-NEXT: store atomic i32 1, ptr @a monotonic, align 4 ; CHECK-NEXT: br label [[MERGE:%.*]] ; CHECK: block2: -; CHECK-NEXT: store atomic i32 2, i32* @a monotonic, align 4 +; CHECK-NEXT: store atomic i32 2, ptr @a monotonic, align 4 ; CHECK-NEXT: br label [[MERGE]] ; CHECK: merge: ; CHECK-NEXT: ret i32 0 @@ -311,10 +311,10 @@ define i32 @test23(i1 %cnd) { br i1 %cnd, label %block1, label %block2 block1: - store atomic i32 1, i32* @a monotonic, align 4 + store atomic i32 1, ptr @a monotonic, align 4 br label %merge block2: - store atomic i32 2, i32* @a monotonic, align 4 + store atomic i32 2, ptr @a monotonic, align 4 br label %merge merge: @@ -323,101 +323,95 @@ merge: declare void @clobber() -define i32 @test18(float* %p) { +define i32 @test18(ptr %p) { ; CHECK-LABEL: @test18( -; CHECK-NEXT: [[X:%.*]] = load atomic float, float* [[P:%.*]] unordered, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic float, ptr [[P:%.*]] unordered, align 4 ; CHECK-NEXT: call void @clobber() -; CHECK-NEXT: store atomic float [[X]], float* [[P]] unordered, align 4 +; CHECK-NEXT: store atomic float [[X]], ptr [[P]] unordered, align 4 ; CHECK-NEXT: ret i32 0 ; - %x = load atomic float, float* %p unordered, align 4 + %x = load atomic float, ptr %p unordered, align 4 call void @clobber() ;; keep the load around - store atomic float %x, float* %p unordered, align 4 + store atomic float %x, ptr %p unordered, align 4 ret i32 0 } ; TODO: probably also legal in this case -define i32 @test19(float* %p) { +define i32 @test19(ptr %p) { ; CHECK-LABEL: @test19( -; CHECK-NEXT: [[X:%.*]] = load atomic float, float* [[P:%.*]] seq_cst, align 4 +; CHECK-NEXT: [[X:%.*]] = load atomic float, ptr [[P:%.*]] seq_cst, align 4 ; CHECK-NEXT: call void @clobber() -; CHECK-NEXT: store atomic float [[X]], float* [[P]] seq_cst, align 4 +; CHECK-NEXT: store atomic float [[X]], ptr [[P]] seq_cst, align 4 ; CHECK-NEXT: ret i32 0 ; - %x = load atomic float, float* %p seq_cst, align 4 + %x = load atomic float, ptr %p seq_cst, align 4 call void @clobber() ;; keep the load around - store atomic float %x, float* %p seq_cst, align 4 + store atomic float %x, ptr %p seq_cst, align 4 ret i32 0 } -define i32 @test20(i32** %p, i8* %v) { +define i32 @test20(ptr %p, ptr %v) { ; CHECK-LABEL: @test20( -; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32** [[P:%.*]] to i8** -; CHECK-NEXT: store atomic i8* [[V:%.*]], i8** [[TMP1]] unordered, align 4 +; CHECK-NEXT: store atomic ptr [[V:%.*]], ptr [[P:%.*]] unordered, align 4 ; CHECK-NEXT: ret i32 0 ; - %cast = bitcast i8* %v to i32* - store atomic i32* %cast, i32** %p unordered, align 4 + store atomic ptr %v, ptr %p unordered, align 4 ret i32 0 } -define i32 @test21(i32** %p, i8* %v) { +define i32 @test21(ptr %p, ptr %v) { ; CHECK-LABEL: @test21( -; CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[V:%.*]] to i32* -; CHECK-NEXT: store atomic i32* [[CAST]], i32** [[P:%.*]] monotonic, align 4 +; CHECK-NEXT: store atomic ptr [[V:%.*]], ptr [[P:%.*]] monotonic, align 4 ; CHECK-NEXT: ret i32 0 ; - %cast = bitcast i8* %v to i32* - store atomic i32* %cast, i32** %p monotonic, align 4 + store atomic ptr %v, ptr %p monotonic, align 4 ret i32 0 } -define void @pr27490a(i8** %p1, i8** %p2) { +define void @pr27490a(ptr %p1, ptr %p2) { ; CHECK-LABEL: @pr27490a( -; CHECK-NEXT: [[L:%.*]] = load i8*, i8** [[P1:%.*]], align 8 -; CHECK-NEXT: store volatile i8* [[L]], i8** [[P2:%.*]], align 8 +; CHECK-NEXT: [[L:%.*]] = load ptr, ptr [[P1:%.*]], align 8 +; CHECK-NEXT: store volatile ptr [[L]], ptr [[P2:%.*]], align 8 ; CHECK-NEXT: ret void ; - %l = load i8*, i8** %p1 - store volatile i8* %l, i8** %p2 + %l = load ptr, ptr %p1 + store volatile ptr %l, ptr %p2 ret void } -define void @pr27490b(i8** %p1, i8** %p2) { +define void @pr27490b(ptr %p1, ptr %p2) { ; CHECK-LABEL: @pr27490b( -; CHECK-NEXT: [[L:%.*]] = load i8*, i8** [[P1:%.*]], align 8 -; CHECK-NEXT: store atomic i8* [[L]], i8** [[P2:%.*]] seq_cst, align 8 +; CHECK-NEXT: [[L:%.*]] = load ptr, ptr [[P1:%.*]], align 8 +; CHECK-NEXT: store atomic ptr [[L]], ptr [[P2:%.*]] seq_cst, align 8 ; CHECK-NEXT: ret void ; - %l = load i8*, i8** %p1 - store atomic i8* %l, i8** %p2 seq_cst, align 8 + %l = load ptr, ptr %p1 + store atomic ptr %l, ptr %p2 seq_cst, align 8 ret void } ;; At the moment, we can't form atomic vectors by folding since these are ;; not representable in the IR. This was pr29121. The right long term ;; solution is to extend the IR to handle this case. -define <2 x float> @no_atomic_vector_load(i64* %p) { +define <2 x float> @no_atomic_vector_load(ptr %p) { ; CHECK-LABEL: @no_atomic_vector_load( -; CHECK-NEXT: [[LOAD:%.*]] = load atomic i64, i64* [[P:%.*]] unordered, align 8 +; CHECK-NEXT: [[LOAD:%.*]] = load atomic i64, ptr [[P:%.*]] unordered, align 8 ; CHECK-NEXT: [[DOTCAST:%.*]] = bitcast i64 [[LOAD]] to <2 x float> ; CHECK-NEXT: ret <2 x float> [[DOTCAST]] ; - %load = load atomic i64, i64* %p unordered, align 8 + %load = load atomic i64, ptr %p unordered, align 8 %.cast = bitcast i64 %load to <2 x float> ret <2 x float> %.cast } -define void @no_atomic_vector_store(<2 x float> %p, i8* %p2) { +define void @no_atomic_vector_store(<2 x float> %p, ptr %p2) { ; CHECK-LABEL: @no_atomic_vector_store( ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x float> [[P:%.*]] to i64 -; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[P2:%.*]] to i64* -; CHECK-NEXT: store atomic i64 [[TMP1]], i64* [[TMP2]] unordered, align 8 +; CHECK-NEXT: store atomic i64 [[TMP1]], ptr [[P2:%.*]] unordered, align 8 ; CHECK-NEXT: ret void ; %1 = bitcast <2 x float> %p to i64 - %2 = bitcast i8* %p2 to i64* - store atomic i64 %1, i64* %2 unordered, align 8 + store atomic i64 %1, ptr %p2 unordered, align 8 ret void } @@ -428,7 +422,7 @@ define i32 @atomic_load_from_constant_global() { ; CHECK-LABEL: @atomic_load_from_constant_global( ; CHECK-NEXT: ret i32 42 ; - %v = load atomic i32, i32* @c seq_cst, align 4 + %v = load atomic i32, ptr @c seq_cst, align 4 ret i32 %v } @@ -436,25 +430,25 @@ define i8 @atomic_load_from_constant_global_bitcast() { ; CHECK-LABEL: @atomic_load_from_constant_global_bitcast( ; CHECK-NEXT: ret i8 42 ; - %v = load atomic i8, i8* bitcast (i32* @c to i8*) seq_cst, align 1 + %v = load atomic i8, ptr @c seq_cst, align 1 ret i8 %v } define void @atomic_load_from_non_constant_global() { ; CHECK-LABEL: @atomic_load_from_non_constant_global( -; CHECK-NEXT: [[TMP1:%.*]] = load atomic i32, i32* @g seq_cst, align 4 +; CHECK-NEXT: [[TMP1:%.*]] = load atomic i32, ptr @g seq_cst, align 4 ; CHECK-NEXT: ret void ; - load atomic i32, i32* @g seq_cst, align 4 + load atomic i32, ptr @g seq_cst, align 4 ret void } define void @volatile_load_from_constant_global() { ; CHECK-LABEL: @volatile_load_from_constant_global( -; CHECK-NEXT: [[TMP1:%.*]] = load volatile i32, i32* @c, align 4 +; CHECK-NEXT: [[TMP1:%.*]] = load volatile i32, ptr @c, align 4 ; CHECK-NEXT: ret void ; - load volatile i32, i32* @c, align 4 + load volatile i32, ptr @c, align 4 ret void } diff --git a/llvm/test/Transforms/InstCombine/atomicrmw.ll b/llvm/test/Transforms/InstCombine/atomicrmw.ll index 4b01c814def4d..5b4b5b184b068 100644 --- a/llvm/test/Transforms/InstCombine/atomicrmw.ll +++ b/llvm/test/Transforms/InstCombine/atomicrmw.ll @@ -5,323 +5,323 @@ ; - the ordering of atomicrmw is compatible with a load (i.e., no release semantic) ; CHECK-LABEL: atomic_add_zero -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_add_zero(i32* %addr) { - %res = atomicrmw add i32* %addr, i32 0 monotonic +define i32 @atomic_add_zero(ptr %addr) { + %res = atomicrmw add ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: atomic_or_zero -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_or_zero(i32* %addr) { - %res = atomicrmw add i32* %addr, i32 0 monotonic +define i32 @atomic_or_zero(ptr %addr) { + %res = atomicrmw add ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: atomic_sub_zero -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_sub_zero(i32* %addr) { - %res = atomicrmw sub i32* %addr, i32 0 monotonic +define i32 @atomic_sub_zero(ptr %addr) { + %res = atomicrmw sub ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: atomic_and_allones -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_and_allones(i32* %addr) { - %res = atomicrmw and i32* %addr, i32 -1 monotonic +define i32 @atomic_and_allones(ptr %addr) { + %res = atomicrmw and ptr %addr, i32 -1 monotonic ret i32 %res } ; CHECK-LABEL: atomic_umin_uint_max -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_umin_uint_max(i32* %addr) { - %res = atomicrmw umin i32* %addr, i32 -1 monotonic +define i32 @atomic_umin_uint_max(ptr %addr) { + %res = atomicrmw umin ptr %addr, i32 -1 monotonic ret i32 %res } ; CHECK-LABEL: atomic_umax_zero -; CHECK-NEXT: %res = load atomic i32, i32* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic i32, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret i32 %res -define i32 @atomic_umax_zero(i32* %addr) { - %res = atomicrmw umax i32* %addr, i32 0 monotonic +define i32 @atomic_umax_zero(ptr %addr) { + %res = atomicrmw umax ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: atomic_min_smax_char -; CHECK-NEXT: %res = load atomic i8, i8* %addr monotonic, align 1 +; CHECK-NEXT: %res = load atomic i8, ptr %addr monotonic, align 1 ; CHECK-NEXT: ret i8 %res -define i8 @atomic_min_smax_char(i8* %addr) { - %res = atomicrmw min i8* %addr, i8 127 monotonic +define i8 @atomic_min_smax_char(ptr %addr) { + %res = atomicrmw min ptr %addr, i8 127 monotonic ret i8 %res } ; CHECK-LABEL: atomic_max_smin_char -; CHECK-NEXT: %res = load atomic i8, i8* %addr monotonic, align 1 +; CHECK-NEXT: %res = load atomic i8, ptr %addr monotonic, align 1 ; CHECK-NEXT: ret i8 %res -define i8 @atomic_max_smin_char(i8* %addr) { - %res = atomicrmw max i8* %addr, i8 -128 monotonic +define i8 @atomic_max_smin_char(ptr %addr) { + %res = atomicrmw max ptr %addr, i8 -128 monotonic ret i8 %res } ; CHECK-LABEL: atomic_fsub -; CHECK-NEXT: %res = load atomic float, float* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic float, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret float %res -define float @atomic_fsub_zero(float* %addr) { - %res = atomicrmw fsub float* %addr, float 0.0 monotonic +define float @atomic_fsub_zero(ptr %addr) { + %res = atomicrmw fsub ptr %addr, float 0.0 monotonic ret float %res } ; CHECK-LABEL: atomic_fadd -; CHECK-NEXT: %res = load atomic float, float* %addr monotonic, align 4 +; CHECK-NEXT: %res = load atomic float, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret float %res -define float @atomic_fadd_zero(float* %addr) { - %res = atomicrmw fadd float* %addr, float -0.0 monotonic +define float @atomic_fadd_zero(ptr %addr) { + %res = atomicrmw fadd ptr %addr, float -0.0 monotonic ret float %res } ; CHECK-LABEL: atomic_fsub_canon -; CHECK-NEXT: %res = atomicrmw fadd float* %addr, float -0.000000e+00 release +; CHECK-NEXT: %res = atomicrmw fadd ptr %addr, float -0.000000e+00 release ; CHECK-NEXT: ret float %res -define float @atomic_fsub_canon(float* %addr) { - %res = atomicrmw fsub float* %addr, float 0.0 release +define float @atomic_fsub_canon(ptr %addr) { + %res = atomicrmw fsub ptr %addr, float 0.0 release ret float %res } ; CHECK-LABEL: atomic_fadd_canon -; CHECK-NEXT: %res = atomicrmw fadd float* %addr, float -0.000000e+00 release +; CHECK-NEXT: %res = atomicrmw fadd ptr %addr, float -0.000000e+00 release ; CHECK-NEXT: ret float %res -define float @atomic_fadd_canon(float* %addr) { - %res = atomicrmw fadd float* %addr, float -0.0 release +define float @atomic_fadd_canon(ptr %addr) { + %res = atomicrmw fadd ptr %addr, float -0.0 release ret float %res } ; Can't replace a volatile w/a load; this would eliminate a volatile store. ; CHECK-LABEL: atomic_sub_zero_volatile -; CHECK-NEXT: %res = atomicrmw volatile sub i64* %addr, i64 0 acquire +; CHECK-NEXT: %res = atomicrmw volatile sub ptr %addr, i64 0 acquire ; CHECK-NEXT: ret i64 %res -define i64 @atomic_sub_zero_volatile(i64* %addr) { - %res = atomicrmw volatile sub i64* %addr, i64 0 acquire +define i64 @atomic_sub_zero_volatile(ptr %addr) { + %res = atomicrmw volatile sub ptr %addr, i64 0 acquire ret i64 %res } ; Check that the transformation properly preserve the syncscope. ; CHECK-LABEL: atomic_syncscope -; CHECK-NEXT: %res = load atomic i16, i16* %addr syncscope("some_syncscope") acquire, align 2 +; CHECK-NEXT: %res = load atomic i16, ptr %addr syncscope("some_syncscope") acquire, align 2 ; CHECK-NEXT: ret i16 %res -define i16 @atomic_syncscope(i16* %addr) { - %res = atomicrmw or i16* %addr, i16 0 syncscope("some_syncscope") acquire +define i16 @atomic_syncscope(ptr %addr) { + %res = atomicrmw or ptr %addr, i16 0 syncscope("some_syncscope") acquire ret i16 %res } ; By eliminating the store part of the atomicrmw, we would get rid of the ; release semantic, which is incorrect. We can canonicalize the operation. ; CHECK-LABEL: atomic_seq_cst -; CHECK-NEXT: %res = atomicrmw or i16* %addr, i16 0 seq_cst +; CHECK-NEXT: %res = atomicrmw or ptr %addr, i16 0 seq_cst ; CHECK-NEXT: ret i16 %res -define i16 @atomic_seq_cst(i16* %addr) { - %res = atomicrmw add i16* %addr, i16 0 seq_cst +define i16 @atomic_seq_cst(ptr %addr) { + %res = atomicrmw add ptr %addr, i16 0 seq_cst ret i16 %res } ; Check that the transformation does not apply when the value is changed by ; the atomic operation (non zero constant). ; CHECK-LABEL: atomic_add_non_zero -; CHECK-NEXT: %res = atomicrmw add i16* %addr, i16 2 monotonic +; CHECK-NEXT: %res = atomicrmw add ptr %addr, i16 2 monotonic ; CHECK-NEXT: ret i16 %res -define i16 @atomic_add_non_zero(i16* %addr) { - %res = atomicrmw add i16* %addr, i16 2 monotonic +define i16 @atomic_add_non_zero(ptr %addr) { + %res = atomicrmw add ptr %addr, i16 2 monotonic ret i16 %res } ; CHECK-LABEL: atomic_xor_zero -; CHECK-NEXT: %res = load atomic i16, i16* %addr monotonic, align 2 +; CHECK-NEXT: %res = load atomic i16, ptr %addr monotonic, align 2 ; CHECK-NEXT: ret i16 %res -define i16 @atomic_xor_zero(i16* %addr) { - %res = atomicrmw xor i16* %addr, i16 0 monotonic +define i16 @atomic_xor_zero(ptr %addr) { + %res = atomicrmw xor ptr %addr, i16 0 monotonic ret i16 %res } ; Check that the transformation does not apply when the ordering is ; incompatible with a load (release). Do canonicalize. ; CHECK-LABEL: atomic_release -; CHECK-NEXT: %res = atomicrmw or i16* %addr, i16 0 release +; CHECK-NEXT: %res = atomicrmw or ptr %addr, i16 0 release ; CHECK-NEXT: ret i16 %res -define i16 @atomic_release(i16* %addr) { - %res = atomicrmw sub i16* %addr, i16 0 release +define i16 @atomic_release(ptr %addr) { + %res = atomicrmw sub ptr %addr, i16 0 release ret i16 %res } ; Check that the transformation does not apply when the ordering is ; incompatible with a load (acquire, release). Do canonicalize. ; CHECK-LABEL: atomic_acq_rel -; CHECK-NEXT: %res = atomicrmw or i16* %addr, i16 0 acq_rel +; CHECK-NEXT: %res = atomicrmw or ptr %addr, i16 0 acq_rel ; CHECK-NEXT: ret i16 %res -define i16 @atomic_acq_rel(i16* %addr) { - %res = atomicrmw xor i16* %addr, i16 0 acq_rel +define i16 @atomic_acq_rel(ptr %addr) { + %res = atomicrmw xor ptr %addr, i16 0 acq_rel ret i16 %res } ; CHECK-LABEL: sat_or_allones -; CHECK-NEXT: %res = atomicrmw xchg i32* %addr, i32 -1 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i32 -1 monotonic ; CHECK-NEXT: ret i32 %res -define i32 @sat_or_allones(i32* %addr) { - %res = atomicrmw or i32* %addr, i32 -1 monotonic +define i32 @sat_or_allones(ptr %addr) { + %res = atomicrmw or ptr %addr, i32 -1 monotonic ret i32 %res } ; CHECK-LABEL: sat_and_zero -; CHECK-NEXT: %res = atomicrmw xchg i32* %addr, i32 0 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i32 0 monotonic ; CHECK-NEXT: ret i32 %res -define i32 @sat_and_zero(i32* %addr) { - %res = atomicrmw and i32* %addr, i32 0 monotonic +define i32 @sat_and_zero(ptr %addr) { + %res = atomicrmw and ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: sat_umin_uint_min -; CHECK-NEXT: %res = atomicrmw xchg i32* %addr, i32 0 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i32 0 monotonic ; CHECK-NEXT: ret i32 %res -define i32 @sat_umin_uint_min(i32* %addr) { - %res = atomicrmw umin i32* %addr, i32 0 monotonic +define i32 @sat_umin_uint_min(ptr %addr) { + %res = atomicrmw umin ptr %addr, i32 0 monotonic ret i32 %res } ; CHECK-LABEL: sat_umax_uint_max -; CHECK-NEXT: %res = atomicrmw xchg i32* %addr, i32 -1 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i32 -1 monotonic ; CHECK-NEXT: ret i32 %res -define i32 @sat_umax_uint_max(i32* %addr) { - %res = atomicrmw umax i32* %addr, i32 -1 monotonic +define i32 @sat_umax_uint_max(ptr %addr) { + %res = atomicrmw umax ptr %addr, i32 -1 monotonic ret i32 %res } ; CHECK-LABEL: sat_min_smin_char -; CHECK-NEXT: %res = atomicrmw xchg i8* %addr, i8 -128 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i8 -128 monotonic ; CHECK-NEXT: ret i8 %res -define i8 @sat_min_smin_char(i8* %addr) { - %res = atomicrmw min i8* %addr, i8 -128 monotonic +define i8 @sat_min_smin_char(ptr %addr) { + %res = atomicrmw min ptr %addr, i8 -128 monotonic ret i8 %res } ; CHECK-LABEL: sat_max_smax_char -; CHECK-NEXT: %res = atomicrmw xchg i8* %addr, i8 127 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, i8 127 monotonic ; CHECK-NEXT: ret i8 %res -define i8 @sat_max_smax_char(i8* %addr) { - %res = atomicrmw max i8* %addr, i8 127 monotonic +define i8 @sat_max_smax_char(ptr %addr) { + %res = atomicrmw max ptr %addr, i8 127 monotonic ret i8 %res } ; CHECK-LABEL: sat_fadd_nan -; CHECK-NEXT: %res = atomicrmw xchg double* %addr, double 0x7FF00000FFFFFFFF release +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, double 0x7FF00000FFFFFFFF release ; CHECK-NEXT: ret double %res -define double @sat_fadd_nan(double* %addr) { - %res = atomicrmw fadd double* %addr, double 0x7FF00000FFFFFFFF release +define double @sat_fadd_nan(ptr %addr) { + %res = atomicrmw fadd ptr %addr, double 0x7FF00000FFFFFFFF release ret double %res } ; CHECK-LABEL: sat_fsub_nan -; CHECK-NEXT: %res = atomicrmw xchg double* %addr, double 0x7FF00000FFFFFFFF release +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, double 0x7FF00000FFFFFFFF release ; CHECK-NEXT: ret double %res -define double @sat_fsub_nan(double* %addr) { - %res = atomicrmw fsub double* %addr, double 0x7FF00000FFFFFFFF release +define double @sat_fsub_nan(ptr %addr) { + %res = atomicrmw fsub ptr %addr, double 0x7FF00000FFFFFFFF release ret double %res } ; CHECK-LABEL: sat_fsub_nan_unused -; CHECK-NEXT: store atomic double 0x7FF00000FFFFFFFF, double* %addr monotonic, align 8 +; CHECK-NEXT: store atomic double 0x7FF00000FFFFFFFF, ptr %addr monotonic, align 8 ; CHECK-NEXT: ret void -define void @sat_fsub_nan_unused(double* %addr) { - atomicrmw fsub double* %addr, double 0x7FF00000FFFFFFFF monotonic +define void @sat_fsub_nan_unused(ptr %addr) { + atomicrmw fsub ptr %addr, double 0x7FF00000FFFFFFFF monotonic ret void } ; CHECK-LABEL: xchg_unused_monotonic -; CHECK-NEXT: store atomic i32 0, i32* %addr monotonic, align 4 +; CHECK-NEXT: store atomic i32 0, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret void -define void @xchg_unused_monotonic(i32* %addr) { - atomicrmw xchg i32* %addr, i32 0 monotonic +define void @xchg_unused_monotonic(ptr %addr) { + atomicrmw xchg ptr %addr, i32 0 monotonic ret void } ; CHECK-LABEL: xchg_unused_release -; CHECK-NEXT: store atomic i32 -1, i32* %addr release, align 4 +; CHECK-NEXT: store atomic i32 -1, ptr %addr release, align 4 ; CHECK-NEXT: ret void -define void @xchg_unused_release(i32* %addr) { - atomicrmw xchg i32* %addr, i32 -1 release +define void @xchg_unused_release(ptr %addr) { + atomicrmw xchg ptr %addr, i32 -1 release ret void } ; CHECK-LABEL: xchg_unused_seq_cst -; CHECK-NEXT: atomicrmw xchg i32* %addr, i32 0 seq_cst +; CHECK-NEXT: atomicrmw xchg ptr %addr, i32 0 seq_cst ; CHECK-NEXT: ret void -define void @xchg_unused_seq_cst(i32* %addr) { - atomicrmw xchg i32* %addr, i32 0 seq_cst +define void @xchg_unused_seq_cst(ptr %addr) { + atomicrmw xchg ptr %addr, i32 0 seq_cst ret void } ; CHECK-LABEL: xchg_unused_volatile -; CHECK-NEXT: atomicrmw volatile xchg i32* %addr, i32 0 monotonic +; CHECK-NEXT: atomicrmw volatile xchg ptr %addr, i32 0 monotonic ; CHECK-NEXT: ret void -define void @xchg_unused_volatile(i32* %addr) { - atomicrmw volatile xchg i32* %addr, i32 0 monotonic +define void @xchg_unused_volatile(ptr %addr) { + atomicrmw volatile xchg ptr %addr, i32 0 monotonic ret void } ; CHECK-LABEL: sat_or_allones_unused -; CHECK-NEXT: store atomic i32 -1, i32* %addr monotonic, align 4 +; CHECK-NEXT: store atomic i32 -1, ptr %addr monotonic, align 4 ; CHECK-NEXT: ret void -define void @sat_or_allones_unused(i32* %addr) { - atomicrmw or i32* %addr, i32 -1 monotonic +define void @sat_or_allones_unused(ptr %addr) { + atomicrmw or ptr %addr, i32 -1 monotonic ret void } ; CHECK-LABEL: undef_operand_unused -; CHECK-NEXT: atomicrmw or i32* %addr, i32 undef monotonic +; CHECK-NEXT: atomicrmw or ptr %addr, i32 undef monotonic ; CHECK-NEXT: ret void -define void @undef_operand_unused(i32* %addr) { - atomicrmw or i32* %addr, i32 undef monotonic +define void @undef_operand_unused(ptr %addr) { + atomicrmw or ptr %addr, i32 undef monotonic ret void } ; CHECK-LABEL: undef_operand_used -; CHECK-NEXT: %res = atomicrmw or i32* %addr, i32 undef monotonic +; CHECK-NEXT: %res = atomicrmw or ptr %addr, i32 undef monotonic ; CHECK-NEXT: ret i32 %res -define i32 @undef_operand_used(i32* %addr) { - %res = atomicrmw or i32* %addr, i32 undef monotonic +define i32 @undef_operand_used(ptr %addr) { + %res = atomicrmw or ptr %addr, i32 undef monotonic ret i32 %res } ; CHECK-LABEL: sat_fmax_inf -; CHECK-NEXT: %res = atomicrmw xchg double* %addr, double 0x7FF0000000000000 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, double 0x7FF0000000000000 monotonic ; CHECK-NEXT: ret double %res -define double @sat_fmax_inf(double* %addr) { - %res = atomicrmw fmax double* %addr, double 0x7FF0000000000000 monotonic +define double @sat_fmax_inf(ptr %addr) { + %res = atomicrmw fmax ptr %addr, double 0x7FF0000000000000 monotonic ret double %res } ; CHECK-LABEL: no_sat_fmax_inf -; CHECK-NEXT: %res = atomicrmw fmax double* %addr, double 1.000000e-01 monotonic +; CHECK-NEXT: %res = atomicrmw fmax ptr %addr, double 1.000000e-01 monotonic ; CHECK-NEXT: ret double %res -define double @no_sat_fmax_inf(double* %addr) { - %res = atomicrmw fmax double* %addr, double 1.000000e-01 monotonic +define double @no_sat_fmax_inf(ptr %addr) { + %res = atomicrmw fmax ptr %addr, double 1.000000e-01 monotonic ret double %res } ; CHECK-LABEL: sat_fmin_inf -; CHECK-NEXT: %res = atomicrmw xchg double* %addr, double 0xFFF0000000000000 monotonic +; CHECK-NEXT: %res = atomicrmw xchg ptr %addr, double 0xFFF0000000000000 monotonic ; CHECK-NEXT: ret double %res -define double @sat_fmin_inf(double* %addr) { - %res = atomicrmw fmin double* %addr, double 0xFFF0000000000000 monotonic +define double @sat_fmin_inf(ptr %addr) { + %res = atomicrmw fmin ptr %addr, double 0xFFF0000000000000 monotonic ret double %res } ; CHECK-LABEL: no_sat_fmin_inf -; CHECK-NEXT: %res = atomicrmw fmin double* %addr, double 1.000000e-01 monotonic +; CHECK-NEXT: %res = atomicrmw fmin ptr %addr, double 1.000000e-01 monotonic ; CHECK-NEXT: ret double %res -define double @no_sat_fmin_inf(double* %addr) { - %res = atomicrmw fmin double* %addr, double 1.000000e-01 monotonic +define double @no_sat_fmin_inf(ptr %addr) { + %res = atomicrmw fmin ptr %addr, double 1.000000e-01 monotonic ret double %res } diff --git a/llvm/test/Transforms/InstCombine/badmalloc.ll b/llvm/test/Transforms/InstCombine/badmalloc.ll index 0c4326741faae..1db1d7ee4656a 100644 --- a/llvm/test/Transforms/InstCombine/badmalloc.ll +++ b/llvm/test/Transforms/InstCombine/badmalloc.ll @@ -3,16 +3,16 @@ target 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" target triple = "x86_64-apple-darwin10.0" -declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") "alloc-family"="malloc" -declare void @free(i8*) allockind("free") "alloc-family"="malloc" +declare noalias ptr @malloc(i64) nounwind allockind("alloc,uninitialized") "alloc-family"="malloc" +declare void @free(ptr) allockind("free") "alloc-family"="malloc" ; PR5130 define i1 @test1() { - %A = call noalias i8* @malloc(i64 4) nounwind - %B = icmp eq i8* %A, null - store i8 0, i8* %A + %A = call noalias ptr @malloc(i64 4) nounwind + %B = icmp eq ptr %A, null + store i8 0, ptr %A - call void @free(i8* %A) + call void @free(ptr %A) ret i1 %B ; CHECK-LABEL: @test1( @@ -20,22 +20,22 @@ define i1 @test1() { } ; CHECK-LABEL: @test2( -define noalias i8* @test2() nounwind { +define noalias ptr @test2() nounwind { entry: ; CHECK: @malloc - %A = call noalias i8* @malloc(i64 4) nounwind + %A = call noalias ptr @malloc(i64 4) nounwind ; CHECK: icmp eq - %tobool = icmp eq i8* %A, null + %tobool = icmp eq ptr %A, null ; CHECK: br i1 br i1 %tobool, label %return, label %if.end if.end: ; CHECK: store - store i8 7, i8* %A + store i8 7, ptr %A br label %return return: ; CHECK: phi - %retval.0 = phi i8* [ %A, %if.end ], [ null, %entry ] - ret i8* %retval.0 + %retval.0 = phi ptr [ %A, %if.end ], [ null, %entry ] + ret ptr %retval.0 } diff --git a/llvm/test/Transforms/InstCombine/bcmp-1.ll b/llvm/test/Transforms/InstCombine/bcmp-1.ll index aafdf2b9232c8..87e06c5c4988f 100644 --- a/llvm/test/Transforms/InstCombine/bcmp-1.ll +++ b/llvm/test/Transforms/InstCombine/bcmp-1.ll @@ -9,40 +9,40 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 @hel = constant [4 x i8] c"hel\00" @hello_u = constant [8 x i8] c"hello_u\00" -declare i32 @bcmp(i8*, i8*, i32) +declare i32 @bcmp(ptr, ptr, i32) ; Check bcmp(mem, mem, size) -> 0. -define i32 @test_simplify1(i8* %mem, i32 %size) { +define i32 @test_simplify1(ptr %mem, i32 %size) { ; CHECK-LABEL: @test_simplify1( ; CHECK-NEXT: ret i32 0 ; - %ret = call i32 @bcmp(i8* %mem, i8* %mem, i32 %size) + %ret = call i32 @bcmp(ptr %mem, ptr %mem, i32 %size) ret i32 %ret } ; Check bcmp(mem1, mem2, 0) -> 0. -define i32 @test_simplify2(i8* %mem1, i8* %mem2) { +define i32 @test_simplify2(ptr %mem1, ptr %mem2) { ; CHECK-LABEL: @test_simplify2( ; CHECK-NEXT: ret i32 0 ; - %ret = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 0) + %ret = call i32 @bcmp(ptr %mem1, ptr %mem2, i32 0) ret i32 %ret } ;; Check bcmp(mem1, mem2, 1) -> *(unsigned char*)mem1 - *(unsigned char*)mem2. -define i32 @test_simplify3(i8* %mem1, i8* %mem2) { +define i32 @test_simplify3(ptr %mem1, ptr %mem2) { ; CHECK-LABEL: @test_simplify3( -; CHECK-NEXT: [[LHSC:%.*]] = load i8, i8* [[MEM1:%.*]], align 1 +; CHECK-NEXT: [[LHSC:%.*]] = load i8, ptr [[MEM1:%.*]], align 1 ; CHECK-NEXT: [[LHSV:%.*]] = zext i8 [[LHSC]] to i32 -; CHECK-NEXT: [[RHSC:%.*]] = load i8, i8* [[MEM2:%.*]], align 1 +; CHECK-NEXT: [[RHSC:%.*]] = load i8, ptr [[MEM2:%.*]], align 1 ; CHECK-NEXT: [[RHSV:%.*]] = zext i8 [[RHSC]] to i32 ; CHECK-NEXT: [[CHARDIFF:%.*]] = sub nsw i32 [[LHSV]], [[RHSV]] ; CHECK-NEXT: ret i32 [[CHARDIFF]] ; - %ret = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 1) + %ret = call i32 @bcmp(ptr %mem1, ptr %mem2, i32 1) ret i32 %ret } @@ -52,9 +52,7 @@ define i32 @test_simplify4() { ; CHECK-LABEL: @test_simplify4( ; CHECK-NEXT: ret i32 0 ; - %mem1 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0 - %mem2 = getelementptr [8 x i8], [8 x i8]* @hello_u, i32 0, i32 0 - %ret = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 3) + %ret = call i32 @bcmp(ptr @hel, ptr @hello_u, i32 3) ret i32 %ret } @@ -62,9 +60,7 @@ define i32 @test_simplify5() { ; CHECK-LABEL: @test_simplify5( ; CHECK-NEXT: ret i32 1 ; - %mem1 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0 - %mem2 = getelementptr [4 x i8], [4 x i8]* @foo, i32 0, i32 0 - %ret = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 3) + %ret = call i32 @bcmp(ptr @hel, ptr @foo, i32 3) ret i32 %ret } @@ -72,9 +68,7 @@ define i32 @test_simplify6() { ; CHECK-LABEL: @test_simplify6( ; CHECK-NEXT: ret i32 -1 ; - %mem1 = getelementptr [4 x i8], [4 x i8]* @foo, i32 0, i32 0 - %mem2 = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0 - %ret = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 3) + %ret = call i32 @bcmp(ptr @foo, ptr @hel, i32 3) ret i32 %ret } @@ -87,11 +81,9 @@ define i1 @test_simplify7(i64 %x, i64 %y) { ; %x.addr = alloca i64, align 8 %y.addr = alloca i64, align 8 - store i64 %x, i64* %x.addr, align 8 - store i64 %y, i64* %y.addr, align 8 - %xptr = bitcast i64* %x.addr to i8* - %yptr = bitcast i64* %y.addr to i8* - %call = call i32 @bcmp(i8* %xptr, i8* %yptr, i32 8) + store i64 %x, ptr %x.addr, align 8 + store i64 %y, ptr %y.addr, align 8 + %call = call i32 @bcmp(ptr %x.addr, ptr %y.addr, i32 8) %cmp = icmp eq i32 %call, 0 ret i1 %cmp } @@ -105,11 +97,9 @@ define i1 @test_simplify8(i32 %x, i32 %y) { ; %x.addr = alloca i32, align 4 %y.addr = alloca i32, align 4 - store i32 %x, i32* %x.addr, align 4 - store i32 %y, i32* %y.addr, align 4 - %xptr = bitcast i32* %x.addr to i8* - %yptr = bitcast i32* %y.addr to i8* - %call = call i32 @bcmp(i8* %xptr, i8* %yptr, i32 4) + store i32 %x, ptr %x.addr, align 4 + store i32 %y, ptr %y.addr, align 4 + %call = call i32 @bcmp(ptr %x.addr, ptr %y.addr, i32 4) %cmp = icmp eq i32 %call, 0 ret i1 %cmp } @@ -123,22 +113,20 @@ define i1 @test_simplify9(i16 %x, i16 %y) { ; %x.addr = alloca i16, align 2 %y.addr = alloca i16, align 2 - store i16 %x, i16* %x.addr, align 2 - store i16 %y, i16* %y.addr, align 2 - %xptr = bitcast i16* %x.addr to i8* - %yptr = bitcast i16* %y.addr to i8* - %call = call i32 @bcmp(i8* %xptr, i8* %yptr, i32 2) + store i16 %x, ptr %x.addr, align 2 + store i16 %y, ptr %y.addr, align 2 + %call = call i32 @bcmp(ptr %x.addr, ptr %y.addr, i32 2) %cmp = icmp eq i32 %call, 0 ret i1 %cmp } -define i1 @test_simplify10(i8* %mem1, i8* %mem2, i32 %size) { +define i1 @test_simplify10(ptr %mem1, ptr %mem2, i32 %size) { ; CHECK-LABEL: @test_simplify10( -; CHECK-NEXT: [[CALL:%.*]] = call i32 @bcmp(i8* [[MEM1:%.*]], i8* [[MEM2:%.*]], i32 [[SIZE:%.*]]) +; CHECK-NEXT: [[CALL:%.*]] = call i32 @bcmp(ptr [[MEM1:%.*]], ptr [[MEM2:%.*]], i32 [[SIZE:%.*]]) ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; - %call = call i32 @bcmp(i8* %mem1, i8* %mem2, i32 %size) + %call = call i32 @bcmp(ptr %mem1, ptr %mem2, i32 %size) %cmp = icmp eq i32 %call, 0 ret i1 %cmp } diff --git a/llvm/test/Transforms/InstCombine/bcopy.ll b/llvm/test/Transforms/InstCombine/bcopy.ll index b4c4ef5546f54..57bfc4abaa7c3 100644 --- a/llvm/test/Transforms/InstCombine/bcopy.ll +++ b/llvm/test/Transforms/InstCombine/bcopy.ll @@ -1,25 +1,23 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -passes=instcombine -data-layout=p:32:32 -S | FileCheck %s -declare void @bcopy(i8* nocapture readonly, i8* nocapture, i32) +declare void @bcopy(ptr nocapture readonly, ptr nocapture, i32) -define void @bcopy_memmove(i8* nocapture readonly %a, i8* nocapture %b) { +define void @bcopy_memmove(ptr nocapture readonly %a, ptr nocapture %b) { ; CHECK-LABEL: @bcopy_memmove( -; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[A:%.*]] to i64* -; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[B:%.*]] to i64* -; CHECK-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1 -; CHECK-NEXT: store i64 [[TMP3]], i64* [[TMP2]], align 1 +; CHECK-NEXT: [[TMP3:%.*]] = load i64, ptr [[A:%.*]], align 1 +; CHECK-NEXT: store i64 [[TMP3]], ptr [[B:%.*]], align 1 ; CHECK-NEXT: ret void ; - tail call void @bcopy(i8* %a, i8* %b, i32 8) + tail call void @bcopy(ptr %a, ptr %b, i32 8) ret void } -define void @bcopy_memmove2(i8* nocapture readonly %a, i8* nocapture %b, i32 %len) { +define void @bcopy_memmove2(ptr nocapture readonly %a, ptr nocapture %b, i32 %len) { ; CHECK-LABEL: @bcopy_memmove2( -; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i32(i8* align 1 [[B:%.*]], i8* align 1 [[A:%.*]], i32 [[LEN:%.*]], i1 false) +; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr align 1 [[B:%.*]], ptr align 1 [[A:%.*]], i32 [[LEN:%.*]], i1 false) ; CHECK-NEXT: ret void ; - tail call void @bcopy(i8* %a, i8* %b, i32 %len) + tail call void @bcopy(ptr %a, ptr %b, i32 %len) ret void } diff --git a/llvm/test/Transforms/InstCombine/binop-phi-operands.ll b/llvm/test/Transforms/InstCombine/binop-phi-operands.ll index a661416b6aa3e..9cc1a418cc572 100644 --- a/llvm/test/Transforms/InstCombine/binop-phi-operands.ll +++ b/llvm/test/Transforms/InstCombine/binop-phi-operands.ll @@ -736,7 +736,7 @@ end: ret i8 %r } -define { i64, i32 } @ParseRetVal(i1 %b, { i64, i32 } ()* %x) { +define { i64, i32 } @ParseRetVal(i1 %b, ptr %x) { ; CHECK-LABEL: @ParseRetVal( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[B:%.*]], label [[T:%.*]], label [[F:%.*]] diff --git a/llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll b/llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll index c987c2885115d..e9f3f1960aab0 100644 --- a/llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll +++ b/llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll @@ -466,14 +466,12 @@ define <2 x i16> @BitcastInsert(i32 %a) { } ; PR17293 -define <2 x i64> @test7(<2 x i8*>* %arg) nounwind { +define <2 x i64> @test7(ptr %arg) nounwind { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[CAST:%.*]] = bitcast <2 x i8*>* [[ARG:%.*]] to <2 x i64>* -; CHECK-NEXT: [[LOAD:%.*]] = load <2 x i64>, <2 x i64>* [[CAST]], align 16 +; CHECK-NEXT: [[LOAD:%.*]] = load <2 x i64>, ptr [[ARG:%.*]], align 16 ; CHECK-NEXT: ret <2 x i64> [[LOAD]] ; - %cast = bitcast <2 x i8*>* %arg to <2 x i64>* - %load = load <2 x i64>, <2 x i64>* %cast, align 16 + %load = load <2 x i64>, ptr %arg, align 16 ret <2 x i64> %load } @@ -489,75 +487,75 @@ define i8 @test8() { define void @constant_fold_vector_to_double() { ; CHECK-LABEL: @constant_fold_vector_to_double( -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0xFFFFFFFFFFFFFFFF, double* undef, align 8 -; CHECK-NEXT: store volatile double 0x162E000004D2, double* undef, align 8 -; CHECK-NEXT: store volatile double bitcast (<2 x i32> to double), double* undef, align 8 -; CHECK-NEXT: store volatile double 0x400000003F800000, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0xFFFFFFFFFFFFFFFF, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0x162E000004D2, ptr undef, align 8 +; CHECK-NEXT: store volatile double bitcast (<2 x i32> to double), ptr undef, align 8 +; CHECK-NEXT: store volatile double 0x400000003F800000, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 ; CHECK-NEXT: ret void ; - store volatile double bitcast (<1 x i64> to double), double* undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<4 x i16> to double), double* undef - store volatile double bitcast (<8 x i8> to double), double* undef + store volatile double bitcast (<1 x i64> to double), ptr undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<4 x i16> to double), ptr undef + store volatile double bitcast (<8 x i8> to double), ptr undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<2 x i32> to double), double* undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<2 x i32> to double), ptr undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<2 x float> to double), double* undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<2 x float> to double), ptr undef - store volatile double bitcast (<2 x i32> zeroinitializer to double), double* undef - store volatile double bitcast (<4 x i16> zeroinitializer to double), double* undef - store volatile double bitcast (<8 x i8> zeroinitializer to double), double* undef - store volatile double bitcast (<16 x i4> zeroinitializer to double), double* undef - store volatile double bitcast (<32 x i2> zeroinitializer to double), double* undef - store volatile double bitcast (<64 x i1> zeroinitializer to double), double* undef + store volatile double bitcast (<2 x i32> zeroinitializer to double), ptr undef + store volatile double bitcast (<4 x i16> zeroinitializer to double), ptr undef + store volatile double bitcast (<8 x i8> zeroinitializer to double), ptr undef + store volatile double bitcast (<16 x i4> zeroinitializer to double), ptr undef + store volatile double bitcast (<32 x i2> zeroinitializer to double), ptr undef + store volatile double bitcast (<64 x i1> zeroinitializer to double), ptr undef ret void } define void @constant_fold_vector_to_float() { ; CHECK-LABEL: @constant_fold_vector_to_float( -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 ; CHECK-NEXT: ret void ; - store volatile float bitcast (<1 x i32> to float), float* undef - store volatile float bitcast (<2 x i16> to float), float* undef - store volatile float bitcast (<4 x i8> to float), float* undef - store volatile float bitcast (<32 x i1> to float), float* undef + store volatile float bitcast (<1 x i32> to float), ptr undef + store volatile float bitcast (<2 x i16> to float), ptr undef + store volatile float bitcast (<4 x i8> to float), ptr undef + store volatile float bitcast (<32 x i1> to float), ptr undef ret void } define void @constant_fold_vector_to_half() { ; CHECK-LABEL: @constant_fold_vector_to_half( -; CHECK-NEXT: store volatile half 0xH4000, half* undef, align 2 -; CHECK-NEXT: store volatile half 0xH4000, half* undef, align 2 +; CHECK-NEXT: store volatile half 0xH4000, ptr undef, align 2 +; CHECK-NEXT: store volatile half 0xH4000, ptr undef, align 2 ; CHECK-NEXT: ret void ; - store volatile half bitcast (<2 x i8> to half), half* undef - store volatile half bitcast (<4 x i4> to half), half* undef + store volatile half bitcast (<2 x i8> to half), ptr undef + store volatile half bitcast (<4 x i4> to half), ptr undef ret void } ; Ensure that we do not crash when looking at such a weird bitcast. -define i8* @bitcast_from_single_element_pointer_vector_to_pointer(<1 x i8*> %ptrvec) { +define ptr @bitcast_from_single_element_pointer_vector_to_pointer(<1 x ptr> %ptrvec) { ; CHECK-LABEL: @bitcast_from_single_element_pointer_vector_to_pointer( -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i8*> [[PTRVEC:%.*]], i64 0 -; CHECK-NEXT: ret i8* [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x ptr> [[PTRVEC:%.*]], i64 0 +; CHECK-NEXT: ret ptr [[TMP1]] ; - %ptr = bitcast <1 x i8*> %ptrvec to i8* - ret i8* %ptr + %ptr = bitcast <1 x ptr> %ptrvec to ptr + ret ptr %ptr } diff --git a/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll b/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll index dad76c15b7c36..bff97777b6e4e 100644 --- a/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll +++ b/llvm/test/Transforms/InstCombine/bitcast-phi-uselistorder.ll @@ -3,29 +3,28 @@ @Q = internal unnamed_addr global double 1.000000e+00, align 8 -define double @test(i1 %c, i64* %p) { +define double @test(i1 %c, ptr %p) { ; CHECK-LABEL: @test( ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[LOAD1:%.*]] = load double, double* @Q, align 8 +; CHECK-NEXT: [[LOAD1:%.*]] = load double, ptr @Q, align 8 ; CHECK-NEXT: br label [[END]] ; CHECK: end: ; CHECK-NEXT: [[TMP0:%.*]] = phi double [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[LOAD1]], [[IF]] ] -; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to double* -; CHECK-NEXT: store double [[TMP0]], double* [[TMP1]], align 8 +; CHECK-NEXT: store double [[TMP0]], ptr [[P:%.*]], align 8 ; CHECK-NEXT: ret double [[TMP0]] ; entry: br i1 %c, label %if, label %end if: - %load = load i64, i64* bitcast (double* @Q to i64*), align 8 + %load = load i64, ptr @Q, align 8 br label %end end: %phi = phi i64 [ 0, %entry ], [ %load, %if ] - store i64 %phi, i64* %p, align 8 + store i64 %phi, ptr %p, align 8 %cast = bitcast i64 %phi to double ret double %cast diff --git a/llvm/test/Transforms/InstCombine/bitcast.ll b/llvm/test/Transforms/InstCombine/bitcast.ll index 1346885f69880..f27866b5823c1 100644 --- a/llvm/test/Transforms/InstCombine/bitcast.ll +++ b/llvm/test/Transforms/InstCombine/bitcast.ll @@ -592,14 +592,12 @@ define <2 x i16> @BitcastInsert(i32 %a) { } ; PR17293 -define <2 x i64> @test7(<2 x i8*>* %arg) nounwind { +define <2 x i64> @test7(ptr %arg) nounwind { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[CAST:%.*]] = bitcast <2 x i8*>* [[ARG:%.*]] to <2 x i64>* -; CHECK-NEXT: [[LOAD:%.*]] = load <2 x i64>, <2 x i64>* [[CAST]], align 16 +; CHECK-NEXT: [[LOAD:%.*]] = load <2 x i64>, ptr [[ARG:%.*]], align 16 ; CHECK-NEXT: ret <2 x i64> [[LOAD]] ; - %cast = bitcast <2 x i8*>* %arg to <2 x i64>* - %load = load <2 x i64>, <2 x i64>* %cast, align 16 + %load = load <2 x i64>, ptr %arg, align 16 ret <2 x i64> %load } @@ -615,87 +613,86 @@ define i8 @test8() { define void @constant_fold_vector_to_double() { ; CHECK-LABEL: @constant_fold_vector_to_double( -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 1.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0xFFFFFFFFFFFFFFFF, double* undef, align 8 -; CHECK-NEXT: store volatile double 0x162E000004D2, double* undef, align 8 -; CHECK-NEXT: store volatile double bitcast (<2 x i32> to double), double* undef, align 8 -; CHECK-NEXT: store volatile double 0x400000003F800000, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 -; CHECK-NEXT: store volatile double 0.000000e+00, double* undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 1.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0xFFFFFFFFFFFFFFFF, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0x162E000004D2, ptr undef, align 8 +; CHECK-NEXT: store volatile double bitcast (<2 x i32> to double), ptr undef, align 8 +; CHECK-NEXT: store volatile double 0x400000003F800000, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 +; CHECK-NEXT: store volatile double 0.000000e+00, ptr undef, align 8 ; CHECK-NEXT: ret void ; - store volatile double bitcast (<1 x i64> to double), double* undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<4 x i16> to double), double* undef - store volatile double bitcast (<8 x i8> to double), double* undef + store volatile double bitcast (<1 x i64> to double), ptr undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<4 x i16> to double), ptr undef + store volatile double bitcast (<8 x i8> to double), ptr undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<2 x i32> to double), double* undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<2 x i32> to double), ptr undef - store volatile double bitcast (<2 x i32> to double), double* undef - store volatile double bitcast (<2 x float> to double), double* undef + store volatile double bitcast (<2 x i32> to double), ptr undef + store volatile double bitcast (<2 x float> to double), ptr undef - store volatile double bitcast (<2 x i32> zeroinitializer to double), double* undef - store volatile double bitcast (<4 x i16> zeroinitializer to double), double* undef - store volatile double bitcast (<8 x i8> zeroinitializer to double), double* undef - store volatile double bitcast (<16 x i4> zeroinitializer to double), double* undef - store volatile double bitcast (<32 x i2> zeroinitializer to double), double* undef - store volatile double bitcast (<64 x i1> zeroinitializer to double), double* undef + store volatile double bitcast (<2 x i32> zeroinitializer to double), ptr undef + store volatile double bitcast (<4 x i16> zeroinitializer to double), ptr undef + store volatile double bitcast (<8 x i8> zeroinitializer to double), ptr undef + store volatile double bitcast (<16 x i4> zeroinitializer to double), ptr undef + store volatile double bitcast (<32 x i2> zeroinitializer to double), ptr undef + store volatile double bitcast (<64 x i1> zeroinitializer to double), ptr undef ret void } define void @constant_fold_vector_to_float() { ; CHECK-LABEL: @constant_fold_vector_to_float( -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 -; CHECK-NEXT: store volatile float 1.000000e+00, float* undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 +; CHECK-NEXT: store volatile float 1.000000e+00, ptr undef, align 4 ; CHECK-NEXT: ret void ; - store volatile float bitcast (<1 x i32> to float), float* undef - store volatile float bitcast (<2 x i16> to float), float* undef - store volatile float bitcast (<4 x i8> to float), float* undef - store volatile float bitcast (<32 x i1> to float), float* undef + store volatile float bitcast (<1 x i32> to float), ptr undef + store volatile float bitcast (<2 x i16> to float), ptr undef + store volatile float bitcast (<4 x i8> to float), ptr undef + store volatile float bitcast (<32 x i1> to float), ptr undef ret void } define void @constant_fold_vector_to_half() { ; CHECK-LABEL: @constant_fold_vector_to_half( -; CHECK-NEXT: store volatile half 0xH4000, half* undef, align 2 -; CHECK-NEXT: store volatile half 0xH4000, half* undef, align 2 +; CHECK-NEXT: store volatile half 0xH4000, ptr undef, align 2 +; CHECK-NEXT: store volatile half 0xH4000, ptr undef, align 2 ; CHECK-NEXT: ret void ; - store volatile half bitcast (<2 x i8> to half), half* undef - store volatile half bitcast (<4 x i4> to half), half* undef + store volatile half bitcast (<2 x i8> to half), ptr undef + store volatile half bitcast (<4 x i4> to half), ptr undef ret void } ; Ensure that we do not crash when looking at such a weird bitcast. -define i8* @bitcast_from_single_element_pointer_vector_to_pointer(<1 x i8*> %ptrvec) { +define ptr @bitcast_from_single_element_pointer_vector_to_pointer(<1 x ptr> %ptrvec) { ; CHECK-LABEL: @bitcast_from_single_element_pointer_vector_to_pointer( -; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x i8*> [[PTRVEC:%.*]], i64 0 -; CHECK-NEXT: ret i8* [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = extractelement <1 x ptr> [[PTRVEC:%.*]], i64 0 +; CHECK-NEXT: ret ptr [[TMP1]] ; - %ptr = bitcast <1 x i8*> %ptrvec to i8* - ret i8* %ptr + %ptr = bitcast <1 x ptr> %ptrvec to ptr + ret ptr %ptr } declare void @f1() declare void @f2() -define i8* @select_bitcast_unsized_pointer(i1 %c) { +define ptr @select_bitcast_unsized_pointer(i1 %c) { ; CHECK-LABEL: @select_bitcast_unsized_pointer( -; CHECK-NEXT: [[B:%.*]] = select i1 [[C:%.*]], i8* bitcast (void ()* @f1 to i8*), i8* bitcast (void ()* @f2 to i8*) -; CHECK-NEXT: ret i8* [[B]] +; CHECK-NEXT: [[B:%.*]] = select i1 [[C:%.*]], ptr @f1, ptr @f2 +; CHECK-NEXT: ret ptr [[B]] ; - %s = select i1 %c, void ()* @f1, void ()* @f2 - %b = bitcast void ()* %s to i8* - ret i8* %b + %s = select i1 %c, ptr @f1, ptr @f2 + ret ptr %s } diff --git a/llvm/test/Transforms/InstCombine/bitreverse-hang.ll b/llvm/test/Transforms/InstCombine/bitreverse-hang.ll index 0c175759b154f..882bb94faa9e1 100644 --- a/llvm/test/Transforms/InstCombine/bitreverse-hang.ll +++ b/llvm/test/Transforms/InstCombine/bitreverse-hang.ll @@ -23,7 +23,7 @@ ; CHECK: define i32 @fn1 define i32 @fn1() #0 { entry: - %b.promoted = load i32, i32* @b, align 4, !tbaa !2 + %b.promoted = load i32, ptr @b, align 4, !tbaa !2 br label %for.body for.body: ; preds = %for.body, %entry @@ -36,7 +36,7 @@ for.body: ; preds = %for.body, %entry br i1 %exitcond, label %for.end, label %for.body for.end: ; preds = %for.body - store i32 %or, i32* @b, align 4, !tbaa !2 + store i32 %or, ptr @b, align 4, !tbaa !2 ret i32 undef } diff --git a/llvm/test/Transforms/InstCombine/bitreverse.ll b/llvm/test/Transforms/InstCombine/bitreverse.ll index 5a3ace16ae0a9..d21d96c4fb1d0 100644 --- a/llvm/test/Transforms/InstCombine/bitreverse.ll +++ b/llvm/test/Transforms/InstCombine/bitreverse.ll @@ -264,14 +264,13 @@ define i4 @shuf_4bits(<4 x i1> %x) { ret i4 %cast } -define i4 @shuf_load_4bits(<4 x i1> * %p) { +define i4 @shuf_load_4bits(ptr %p) { ; CHECK-LABEL: @shuf_load_4bits( -; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i1>* [[P:%.*]] to i4* -; CHECK-NEXT: [[X1:%.*]] = load i4, i4* [[TMP1]], align 1 +; CHECK-NEXT: [[X1:%.*]] = load i4, ptr [[P:%.*]], align 1 ; CHECK-NEXT: [[CAST:%.*]] = call i4 @llvm.bitreverse.i4(i4 [[X1]]) ; CHECK-NEXT: ret i4 [[CAST]] ; - %x = load <4 x i1>, <4 x i1>* %p + %x = load <4 x i1>, ptr %p %bitreverse = shufflevector <4 x i1> %x, <4 x i1> undef, <4 x i32> %cast = bitcast <4 x i1> %bitreverse to i4 ret i4 %cast diff --git a/llvm/test/Transforms/InstCombine/bittest.ll b/llvm/test/Transforms/InstCombine/bittest.ll index 5b8ec120c3043..1df6f8a2a0814 100644 --- a/llvm/test/Transforms/InstCombine/bittest.ll +++ b/llvm/test/Transforms/InstCombine/bittest.ll @@ -1,15 +1,15 @@ ; RUN: opt < %s -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S |\ ; RUN: not grep "call void @abort" -@b_rec.0 = external global i32 ; [#uses=2] +@b_rec.0 = external global i32 ; [#uses=2] -define void @_Z12h000007_testv(i32* %P) { +define void @_Z12h000007_testv(ptr %P) { entry: - %tmp.2 = load i32, i32* @b_rec.0 ; [#uses=1] + %tmp.2 = load i32, ptr @b_rec.0 ; [#uses=1] %tmp.9 = or i32 %tmp.2, -989855744 ; [#uses=2] %tmp.16 = and i32 %tmp.9, -805306369 ; [#uses=2] %tmp.17 = and i32 %tmp.9, -973078529 ; [#uses=1] - store i32 %tmp.17, i32* @b_rec.0 + store i32 %tmp.17, ptr @b_rec.0 %tmp.17.shrunk = bitcast i32 %tmp.16 to i32 ; [#uses=1] %tmp.22 = and i32 %tmp.17.shrunk, -1073741824 ; [#uses=1] %tmp.23 = icmp eq i32 %tmp.22, -1073741824 ; [#uses=1] @@ -22,7 +22,7 @@ then.0: ; preds = %entry endif.0: ; preds = %entry %tmp.17.shrunk2 = bitcast i32 %tmp.16 to i32 ; [#uses=1] %tmp.27.mask = and i32 %tmp.17.shrunk2, 100663295 ; [#uses=1] - store i32 %tmp.27.mask, i32* %P + store i32 %tmp.27.mask, ptr %P ret void } diff --git a/llvm/test/Transforms/InstCombine/branch.ll b/llvm/test/Transforms/InstCombine/branch.ll index af87d238c9da0..70a818242ae56 100644 --- a/llvm/test/Transforms/InstCombine/branch.ll +++ b/llvm/test/Transforms/InstCombine/branch.ll @@ -26,7 +26,7 @@ define i32 @pat(i32 %x) { ; CHECK: patatino: ; CHECK-NEXT: ret i32 [[X:%.*]] ; - %y = icmp eq i32 27, ptrtoint(i8* @global to i32) + %y = icmp eq i32 27, ptrtoint(ptr @global to i32) br i1 %y, label %patatino, label %patatino patatino: ret i32 %x diff --git a/llvm/test/Transforms/InstCombine/bswap-fold.ll b/llvm/test/Transforms/InstCombine/bswap-fold.ll index 1e1903f18f1e6..394cbb0478bdb 100644 --- a/llvm/test/Transforms/InstCombine/bswap-fold.ll +++ b/llvm/test/Transforms/InstCombine/bswap-fold.ll @@ -71,15 +71,15 @@ define i32 @lshr12_i32(i32 %x) { ; negative test - uses -define i32 @lshr8_i32_use(i32 %x, i32* %p) { +define i32 @lshr8_i32_use(i32 %x, ptr %p) { ; CHECK-LABEL: @lshr8_i32_use( ; CHECK-NEXT: [[S:%.*]] = lshr i32 [[X:%.*]], 12 -; CHECK-NEXT: store i32 [[S]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[S]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.bswap.i32(i32 [[S]]) ; CHECK-NEXT: ret i32 [[R]] ; %s = lshr i32 %x, 12 - store i32 %s, i32* %p + store i32 %s, ptr %p %r = call i32 @llvm.bswap.i32(i32 %s) ret i32 %r } @@ -133,15 +133,15 @@ define i64 @shl42_i64(i64 %x) { ; negative test - uses -define i32 @shl8_i32_use(i32 %x, i32* %p) { +define i32 @shl8_i32_use(i32 %x, ptr %p) { ; CHECK-LABEL: @shl8_i32_use( ; CHECK-NEXT: [[S:%.*]] = shl i32 [[X:%.*]], 8 -; CHECK-NEXT: store i32 [[S]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[S]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.bswap.i32(i32 [[S]]) ; CHECK-NEXT: ret i32 [[R]] ; %s = shl i32 %x, 8 - store i32 %s, i32* %p + store i32 %s, ptr %p %r = call i32 @llvm.bswap.i32(i32 %s) ret i32 %r } diff --git a/llvm/test/Transforms/InstCombine/bswap-inseltpoison.ll b/llvm/test/Transforms/InstCombine/bswap-inseltpoison.ll index 714d6b3d3903a..fd114d4c06533 100644 --- a/llvm/test/Transforms/InstCombine/bswap-inseltpoison.ll +++ b/llvm/test/Transforms/InstCombine/bswap-inseltpoison.ll @@ -17,14 +17,13 @@ define i32 @shuf_4bytes(<4 x i8> %x) { ret i32 %cast } -define i32 @shuf_load_4bytes(<4 x i8>* %p) { +define i32 @shuf_load_4bytes(ptr %p) { ; CHECK-LABEL: @shuf_load_4bytes( -; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i8>* [[P:%.*]] to i32* -; CHECK-NEXT: [[X1:%.*]] = load i32, i32* [[TMP1]], align 4 +; CHECK-NEXT: [[X1:%.*]] = load i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CAST:%.*]] = call i32 @llvm.bswap.i32(i32 [[X1]]) ; CHECK-NEXT: ret i32 [[CAST]] ; - %x = load <4 x i8>, <4 x i8>* %p + %x = load <4 x i8>, ptr %p %bswap = shufflevector <4 x i8> %x, <4 x i8> poison, <4 x i32> %cast = bitcast <4 x i8> %bswap to i32 ret i32 %cast diff --git a/llvm/test/Transforms/InstCombine/bswap.ll b/llvm/test/Transforms/InstCombine/bswap.ll index 233b0b9cdf3d8..09dbff00f0055 100644 --- a/llvm/test/Transforms/InstCombine/bswap.ll +++ b/llvm/test/Transforms/InstCombine/bswap.ll @@ -662,14 +662,13 @@ define i32 @shuf_4bytes(<4 x i8> %x) { ret i32 %cast } -define i32 @shuf_load_4bytes(<4 x i8>* %p) { +define i32 @shuf_load_4bytes(ptr %p) { ; CHECK-LABEL: @shuf_load_4bytes( -; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i8>* [[P:%.*]] to i32* -; CHECK-NEXT: [[X1:%.*]] = load i32, i32* [[TMP1]], align 4 +; CHECK-NEXT: [[X1:%.*]] = load i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CAST:%.*]] = call i32 @llvm.bswap.i32(i32 [[X1]]) ; CHECK-NEXT: ret i32 [[CAST]] ; - %x = load <4 x i8>, <4 x i8>* %p + %x = load <4 x i8>, ptr %p %bswap = shufflevector <4 x i8> %x, <4 x i8> undef, <4 x i32> %cast = bitcast <4 x i8> %bswap to i32 ret i32 %cast @@ -773,9 +772,9 @@ define i32 @funnel_and(i32 %abcd) { } ; Don't attempt to collectBitParts from >128 bit integers -define i16 @trunc_bswap_i160(i160* %a0) { +define i16 @trunc_bswap_i160(ptr %a0) { ; CHECK-LABEL: @trunc_bswap_i160( -; CHECK-NEXT: [[LOAD:%.*]] = load i160, i160* [[A0:%.*]], align 4 +; CHECK-NEXT: [[LOAD:%.*]] = load i160, ptr [[A0:%.*]], align 4 ; CHECK-NEXT: [[LSHR1:%.*]] = lshr i160 [[LOAD]], 136 ; CHECK-NEXT: [[CAST1:%.*]] = trunc i160 [[LSHR1]] to i16 ; CHECK-NEXT: [[AND1:%.*]] = and i16 [[CAST1]], 255 @@ -785,7 +784,7 @@ define i16 @trunc_bswap_i160(i160* %a0) { ; CHECK-NEXT: [[OR:%.*]] = or i16 [[AND1]], [[SHL]] ; CHECK-NEXT: ret i16 [[OR]] ; - %load = load i160, i160* %a0, align 4 + %load = load i160, ptr %a0, align 4 %lshr0 = lshr i160 %load, 128 %lshr1 = lshr i160 %load, 136 %cast0 = trunc i160 %lshr0 to i16 diff --git a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll index 7960ac93c0028..763645088bde5 100644 --- a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll +++ b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll @@ -6,9 +6,9 @@ target triple = "x86_64-apple-macosx10.14.0" ; Function Attrs: nounwind ssp uwtable define i64 @weird_identity_but_ok(i64 %sz) { entry: - %call = tail call i8* @malloc(i64 %sz) - %calc_size = tail call i64 @llvm.objectsize.i64.p0i8(i8* %call, i1 false, i1 true, i1 true) - tail call void @free(i8* %call) + %call = tail call ptr @malloc(i64 %sz) + %calc_size = tail call i64 @llvm.objectsize.i64.p0(ptr %call, i1 false, i1 true, i1 true) + tail call void @free(ptr %call) ret i64 %calc_size } @@ -22,16 +22,16 @@ entry: br i1 %which, label %first_label, label %second_label first_label: - %first_call = call i8* @malloc(i64 10) + %first_call = call ptr @malloc(i64 10) br label %join_label second_label: - %second_call = call i8* @malloc(i64 30) + %second_call = call ptr @malloc(i64 30) br label %join_label join_label: - %joined = phi i8* [ %first_call, %first_label ], [ %second_call, %second_label ] - %calc_size = tail call i64 @llvm.objectsize.i64.p0i8(i8* %joined, i1 false, i1 true, i1 true) + %joined = phi ptr [ %first_call, %first_label ], [ %second_call, %second_label ] + %calc_size = tail call i64 @llvm.objectsize.i64.p0(ptr %joined, i1 false, i1 true, i1 true) ret i64 %calc_size } @@ -40,9 +40,9 @@ join_label: define i64 @internal_pointer(i64 %sz) { entry: - %ptr = call i8* @malloc(i64 %sz) - %ptr2 = getelementptr inbounds i8, i8* %ptr, i32 2 - %calc_size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr2, i1 false, i1 true, i1 true) + %ptr = call ptr @malloc(i64 %sz) + %ptr2 = getelementptr inbounds i8, ptr %ptr, i32 2 + %calc_size = call i64 @llvm.objectsize.i64.p0(ptr %ptr2, i1 false, i1 true, i1 true) ret i64 %calc_size } @@ -54,16 +54,16 @@ entry: define i64 @uses_nullptr_no_fold() { entry: - %res = call i64 @llvm.objectsize.i64.p0i8(i8* null, i1 false, i1 true, i1 true) + %res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 true, i1 true) ret i64 %res } -; CHECK: %res = call i64 @llvm.objectsize.i64.p0i8(i8* null, i1 false, i1 true, i1 true) +; CHECK: %res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 true, i1 true) define i64 @uses_nullptr_fold() { entry: ; NOTE: the third parameter to this call is false, unlike above. - %res = call i64 @llvm.objectsize.i64.p0i8(i8* null, i1 false, i1 false, i1 true) + %res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 false, i1 true) ret i64 %res } @@ -75,22 +75,22 @@ entry: ; Function Attrs: nounwind define void @f() { entry: - %.pr = load i32, i32* @c, align 4 + %.pr = load i32, ptr @c, align 4 %tobool4 = icmp eq i32 %.pr, 0 br i1 %tobool4, label %for.end, label %for.body for.body: ; preds = %entry, %for.body - %dp.05 = phi i8* [ %add.ptr, %for.body ], [ @d, %entry ] - %0 = tail call i64 @llvm.objectsize.i64.p0i8(i8* %dp.05, i1 false, i1 true, i1 true) + %dp.05 = phi ptr [ %add.ptr, %for.body ], [ @d, %entry ] + %0 = tail call i64 @llvm.objectsize.i64.p0(ptr %dp.05, i1 false, i1 true, i1 true) %conv = trunc i64 %0 to i32 tail call void @bury(i32 %conv) #3 - %1 = load i32, i32* @c, align 4 + %1 = load i32, ptr @c, align 4 %idx.ext = sext i32 %1 to i64 %add.ptr.offs = add i64 %idx.ext, 0 %2 = add i64 undef, %add.ptr.offs - %add.ptr = getelementptr inbounds i8, i8* %dp.05, i64 %idx.ext + %add.ptr = getelementptr inbounds i8, ptr %dp.05, i64 %idx.ext %add = shl nsw i32 %1, 1 - store i32 %add, i32* @c, align 4 + store i32 %add, ptr @c, align 4 %tobool = icmp eq i32 %1, 0 br i1 %tobool, label %for.end, label %for.body @@ -99,21 +99,21 @@ for.end: ; preds = %for.body, %entry } ; CHECK: define void @f() -; CHECK: call i64 @llvm.objectsize.i64.p0i8( +; CHECK: call i64 @llvm.objectsize.i64.p0( define void @bdos_cmpm1(i64 %alloc) { entry: - %obj = call i8* @malloc(i64 %alloc) - %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %obj, i1 0, i1 0, i1 1) + %obj = call ptr @malloc(i64 %alloc) + %objsize = call i64 @llvm.objectsize.i64.p0(ptr %obj, i1 0, i1 0, i1 1) %cmp.not = icmp eq i64 %objsize, -1 br i1 %cmp.not, label %if.else, label %if.then if.then: - call void @fortified_chk(i8* %obj, i64 %objsize) + call void @fortified_chk(ptr %obj, i64 %objsize) br label %if.end if.else: - call void @unfortified(i8* %obj, i64 %objsize) + call void @unfortified(ptr %obj, i64 %objsize) br label %if.end if.end: ; preds = %if.else, %if.then @@ -124,22 +124,22 @@ if.end: ; preds = %if.else, %if.then ; CHECK: [[TMP:%.*]] = icmp ne i64 %alloc, -1 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP]]) ; CHECK-NEXT: br i1 false, label %if.else, label %if.then -; CHECK: call void @fortified_chk(i8* %obj, i64 %alloc) +; CHECK: call void @fortified_chk(ptr %obj, i64 %alloc) define void @bdos_cmpm1_expr(i64 %alloc, i64 %part) { entry: %sz = udiv i64 %alloc, %part - %obj = call i8* @malloc(i64 %sz) - %objsize = call i64 @llvm.objectsize.i64.p0i8(i8* %obj, i1 0, i1 0, i1 1) + %obj = call ptr @malloc(i64 %sz) + %objsize = call i64 @llvm.objectsize.i64.p0(ptr %obj, i1 0, i1 0, i1 1) %cmp.not = icmp eq i64 %objsize, -1 br i1 %cmp.not, label %if.else, label %if.then if.then: - call void @fortified_chk(i8* %obj, i64 %objsize) + call void @fortified_chk(ptr %obj, i64 %objsize) br label %if.end if.else: - call void @unfortified(i8* %obj, i64 %objsize) + call void @unfortified(ptr %obj, i64 %objsize) br label %if.end if.end: ; preds = %if.else, %if.then @@ -150,7 +150,7 @@ if.end: ; preds = %if.else, %if.then ; CHECK: [[TMP:%.*]] = icmp ne i64 [[SZ:%.*]], -1 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP]]) ; CHECK-NEXT: br i1 false, label %if.else, label %if.then -; CHECK: call void @fortified_chk(i8* %obj, i64 [[SZ]]) +; CHECK: call void @fortified_chk(ptr %obj, i64 [[SZ]]) @p7 = internal addrspace(7) global i8 0 @@ -165,11 +165,11 @@ define i64 @as_cast(i1 %c) { ; CHECK: ret i64 [[TMP1]] ; entry: - %p0 = tail call i8* @malloc(i64 64) - %gep = getelementptr i8, i8 addrspace(7)* @p7, i32 1 - %as = addrspacecast i8 addrspace(7)* %gep to i8* - %select = select i1 %c, i8* %p0, i8* %as - %calc_size = tail call i64 @llvm.objectsize.i64.p0i8(i8* %select, i1 false, i1 true, i1 true) + %p0 = tail call ptr @malloc(i64 64) + %gep = getelementptr i8, ptr addrspace(7) @p7, i32 1 + %as = addrspacecast ptr addrspace(7) %gep to ptr + %select = select i1 %c, ptr %p0, ptr %as + %calc_size = tail call i64 @llvm.objectsize.i64.p0(ptr %select, i1 false, i1 true, i1 true) ret i64 %calc_size } @@ -183,25 +183,25 @@ define i64 @constexpr_as_cast(i1 %c) { ; CHECK: ret i64 [[TMP1]] ; entry: - %p0 = tail call i8* @malloc(i64 64) - %select = select i1 %c, i8* %p0, i8* addrspacecast (i8 addrspace(7)* getelementptr (i8, i8 addrspace(7)* @p7, i32 1) to i8*) - %calc_size = tail call i64 @llvm.objectsize.i64.p0i8(i8* %select, i1 false, i1 true, i1 true) + %p0 = tail call ptr @malloc(i64 64) + %select = select i1 %c, ptr %p0, ptr addrspacecast (ptr addrspace(7) getelementptr (i8, ptr addrspace(7) @p7, i32 1) to ptr) + %calc_size = tail call i64 @llvm.objectsize.i64.p0(ptr %select, i1 false, i1 true, i1 true) ret i64 %calc_size } declare void @bury(i32) local_unnamed_addr #2 ; Function Attrs: nounwind allocsize(0) -declare i8* @malloc(i64) nounwind allocsize(0) allockind("alloc,uninitialized") "alloc-family"="malloc" +declare ptr @malloc(i64) nounwind allocsize(0) allockind("alloc,uninitialized") "alloc-family"="malloc" -declare i8* @get_unknown_buffer() +declare ptr @get_unknown_buffer() ; Function Attrs: nounwind -declare void @free(i8* nocapture) nounwind allockind("free") "alloc-family"="malloc" +declare void @free(ptr nocapture) nounwind allockind("free") "alloc-family"="malloc" ; Function Attrs: nounwind readnone speculatable -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) +declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) -declare void @fortified_chk(i8*, i64) +declare void @fortified_chk(ptr, i64) -declare void @unfortified(i8*, i64) +declare void @unfortified(ptr, i64) diff --git a/llvm/test/Transforms/InstCombine/builtin-object-size-custom-dl.ll b/llvm/test/Transforms/InstCombine/builtin-object-size-custom-dl.ll index 151c5b04ca48b..fe8b321114e47 100644 --- a/llvm/test/Transforms/InstCombine/builtin-object-size-custom-dl.ll +++ b/llvm/test/Transforms/InstCombine/builtin-object-size-custom-dl.ll @@ -4,9 +4,9 @@ target datalayout = "e-m:o-p:40:64:64:32-i64:64-f80:128-n8:16:32:64-S128" ; check that memory builtins can be handled. define i64 @objsize1_custom_idx(i64 %sz) { entry: - %ptr = call i8* @malloc(i64 %sz) - %ptr2 = getelementptr inbounds i8, i8* %ptr, i32 2 - %calc_size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr2, i1 false, i1 true, i1 true) + %ptr = call ptr @malloc(i64 %sz) + %ptr2 = getelementptr inbounds i8, ptr %ptr, i32 2 + %calc_size = call i64 @llvm.objectsize.i64.p0(ptr %ptr2, i1 false, i1 true, i1 true) ret i64 %calc_size } @@ -15,18 +15,16 @@ entry: define i32 @objsize2_custom_idx() #0 { entry: %var = alloca %struct.V, align 4 - %0 = bitcast %struct.V* %var to i8* - call void @llvm.lifetime.start.p0i8(i64 28, i8* %0) #3 - %buf1 = getelementptr inbounds %struct.V, %struct.V* %var, i32 0, i32 0 - %arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf1, i64 0, i64 1 - %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %arrayidx, i1 false, i1 false, i1 false) - %conv = trunc i64 %1 to i32 - call void @llvm.lifetime.end.p0i8(i64 28, i8* %0) #3 + call void @llvm.lifetime.start.p0(i64 28, ptr %var) #3 + %arrayidx = getelementptr inbounds [10 x i8], ptr %var, i64 0, i64 1 + %0 = call i64 @llvm.objectsize.i64.p0(ptr %arrayidx, i1 false, i1 false, i1 false) + %conv = trunc i64 %0 to i32 + call void @llvm.lifetime.end.p0(i64 28, ptr %var) #3 ret i32 %conv ; CHECK: ret i32 27 } -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 -declare i8* @malloc(i64) -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) +declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 +declare ptr @malloc(i64) +declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) diff --git a/llvm/test/Transforms/InstCombine/builtin-object-size-offset.ll b/llvm/test/Transforms/InstCombine/builtin-object-size-offset.ll index cb6c2186099e9..b8919a76b122a 100644 --- a/llvm/test/Transforms/InstCombine/builtin-object-size-offset.ll +++ b/llvm/test/Transforms/InstCombine/builtin-object-size-offset.ll @@ -25,34 +25,32 @@ define i32 @foo1(i32 %N) { entry: %Big = alloca [20 x i8], align 16 %Small = alloca [10 x i8], align 1 - %0 = getelementptr inbounds [20 x i8], [20 x i8]* %Big, i64 0, i64 0 - call void @llvm.lifetime.start.p0i8(i64 20, i8* %0) - %1 = getelementptr inbounds [10 x i8], [10 x i8]* %Small, i64 0, i64 0 - call void @llvm.lifetime.start.p0i8(i64 10, i8* %1) + call void @llvm.lifetime.start.p0(i64 20, ptr %Big) + call void @llvm.lifetime.start.p0(i64 10, ptr %Small) %tobool = icmp ne i32 %N, 0 - %add.ptr = getelementptr inbounds [20 x i8], [20 x i8]* %Big, i64 0, i64 10 - %cond = select i1 %tobool, i8* %add.ptr, i8* %1 - %2 = call i64 @llvm.objectsize.i64.p0i8(i8* %cond, i1 false) - %conv = trunc i64 %2 to i32 - call void @llvm.lifetime.end.p0i8(i64 10, i8* %1) - call void @llvm.lifetime.end.p0i8(i64 20, i8* %0) + %add.ptr = getelementptr inbounds [20 x i8], ptr %Big, i64 0, i64 10 + %cond = select i1 %tobool, ptr %add.ptr, ptr %Small + %0 = call i64 @llvm.objectsize.i64.p0(ptr %cond, i1 false) + %conv = trunc i64 %0 to i32 + call void @llvm.lifetime.end.p0(i64 10, ptr %Small) + call void @llvm.lifetime.end.p0(i64 20, ptr %Big) ret i32 %conv ; CHECK: ret i32 10 } -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) +declare void @llvm.lifetime.start.p0(i64, ptr nocapture) -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) +declare i64 @llvm.objectsize.i64.p0(ptr, i1) -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) define void @foo() { entry: %call = tail call i32 @foo1(i32 0) %conv = sext i32 %call to i64 - %call1 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %conv) + %call1 = tail call i32 (ptr, ...) @printf(ptr @.str, i64 %conv) ret void } -declare i32 @printf(i8* nocapture readonly, ...) +declare i32 @printf(ptr nocapture readonly, ...) diff --git a/llvm/test/Transforms/InstCombine/builtin-object-size-ptr.ll b/llvm/test/Transforms/InstCombine/builtin-object-size-ptr.ll index 0fb26baa75e4b..533451f26666a 100644 --- a/llvm/test/Transforms/InstCombine/builtin-object-size-ptr.ll +++ b/llvm/test/Transforms/InstCombine/builtin-object-size-ptr.ll @@ -18,13 +18,11 @@ define i32 @foo() #0 { ; CHECK-NEXT: ret i32 27 ; %var = alloca %struct.V, align 4 - %t0 = bitcast %struct.V* %var to i8* - call void @llvm.lifetime.start.p0i8(i64 28, i8* %t0) #3 - %buf1 = getelementptr inbounds %struct.V, %struct.V* %var, i32 0, i32 0 - %arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buf1, i64 0, i64 1 - %t1 = call i64 @llvm.objectsize.i64.p0i8(i8* %arrayidx, i1 false) + call void @llvm.lifetime.start.p0(i64 28, ptr %var) #3 + %arrayidx = getelementptr inbounds [10 x i8], ptr %var, i64 0, i64 1 + %t1 = call i64 @llvm.objectsize.i64.p0(ptr %arrayidx, i1 false) %conv = trunc i64 %t1 to i32 - call void @llvm.lifetime.end.p0i8(i64 28, i8* %t0) #3 + call void @llvm.lifetime.end.p0(i64 28, ptr %var) #3 ret i32 %conv } @@ -36,40 +34,38 @@ define void @PR43723() { ; CHECK-NEXT: ret void ; %tab = alloca [10 x i8], align 16 - %t0 = bitcast [10 x i8]* %tab to i8* - call void @llvm.memset.p0i8.i64(i8* align 16 %t0, i8 9, i64 10, i1 false) - %t1 = call {}* @llvm.invariant.start.p0i8(i64 10, i8* align 16 %t0) - call void @llvm.invariant.end.p0i8({}* %t1, i64 10, i8* align 16 %t0) + call void @llvm.memset.p0.i64(ptr align 16 %tab, i8 9, i64 10, i1 false) + %t1 = call ptr @llvm.invariant.start.p0(i64 10, ptr align 16 %tab) + call void @llvm.invariant.end.p0(ptr %t1, i64 10, ptr align 16 %tab) ret void - uselistorder i8* %t0, { 1, 0, 2 } + uselistorder ptr %tab, { 1, 0, 2 } } -define void @unknown_use_of_invariant_start({}** %p) { +define void @unknown_use_of_invariant_start(ptr %p) { ; CHECK-LABEL: @unknown_use_of_invariant_start( ; CHECK-NEXT: ret void ; %tab = alloca [10 x i8], align 16 - %t0 = bitcast [10 x i8]* %tab to i8* - call void @llvm.memset.p0i8.i64(i8* align 16 %t0, i8 9, i64 10, i1 false) - %t1 = call {}* @llvm.invariant.start.p0i8(i64 10, i8* align 16 %t0) - call void @llvm.invariant.end.p0i8({}* %t1, i64 10, i8* align 16 %t0) - store {}* %t1, {}** %p + call void @llvm.memset.p0.i64(ptr align 16 %tab, i8 9, i64 10, i1 false) + %t1 = call ptr @llvm.invariant.start.p0(i64 10, ptr align 16 %tab) + call void @llvm.invariant.end.p0(ptr %t1, i64 10, ptr align 16 %tab) + store ptr %t1, ptr %p ret void } -define {}* @minimal_invariant_start_use(i8 %x) { +define ptr @minimal_invariant_start_use(i8 %x) { ; CHECK-LABEL: @minimal_invariant_start_use( -; CHECK-NEXT: ret {}* poison +; CHECK-NEXT: ret ptr poison ; %a = alloca i8 - %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a) - ret {}* %i + %i = call ptr @llvm.invariant.start.p0(i64 1, ptr %a) + ret ptr %i } -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) #2 -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #0 -declare {}* @llvm.invariant.start.p0i8(i64 immarg, i8* nocapture) #0 -declare void @llvm.invariant.end.p0i8({}*, i64 immarg, i8* nocapture) #0 +declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 +declare i64 @llvm.objectsize.i64.p0(ptr, i1) #2 +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 +declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0 +declare ptr @llvm.invariant.start.p0(i64 immarg, ptr nocapture) #0 +declare void @llvm.invariant.end.p0(ptr, i64 immarg, ptr nocapture) #0 diff --git a/llvm/test/Transforms/InstCombine/builtin-object-size-strdup-family.ll b/llvm/test/Transforms/InstCombine/builtin-object-size-strdup-family.ll index 4d21693c6d5f2..f8bbe74a8c373 100644 --- a/llvm/test/Transforms/InstCombine/builtin-object-size-strdup-family.ll +++ b/llvm/test/Transforms/InstCombine/builtin-object-size-strdup-family.ll @@ -5,12 +5,12 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg) -declare noalias i8* @strdup(i8*); -declare noalias i8* @__strdup(i8*); -declare noalias i8* @strndup(i8*, i64); -declare noalias i8* @__strndup(i8*, i64); +declare dso_local noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr +declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg) +declare noalias ptr @strdup(ptr); +declare noalias ptr @__strdup(ptr); +declare noalias ptr @strndup(ptr, i64); +declare noalias ptr @__strndup(ptr, i64); @str = dso_local constant [11 x i8] c"toulbroc'h\00" @@ -18,8 +18,8 @@ define dso_local i64 @check_strdup(i32 noundef %n) local_unnamed_addr { ; CHECK-LABEL: @check_strdup( ; CHECK-NEXT: ret i64 11 ; - %ptr = call noalias i8* @strdup(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0)) - %size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr, i1 false, i1 true, i1 false) + %ptr = call noalias ptr @strdup(ptr noundef @str) + %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false) ret i64 %size } @@ -27,8 +27,8 @@ define dso_local i64 @check_dunder_strdup(i32 noundef %n) local_unnamed_addr { ; CHECK-LABEL: @check_dunder_strdup( ; CHECK-NEXT: ret i64 11 ; - %ptr = call noalias i8* @__strdup(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0)) - %size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr, i1 false, i1 true, i1 false) + %ptr = call noalias ptr @__strdup(ptr noundef @str) + %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false) ret i64 %size } @@ -36,8 +36,8 @@ define dso_local i64 @check_strndup(i32 noundef %n) local_unnamed_addr { ; CHECK-LABEL: @check_strndup( ; CHECK-NEXT: ret i64 5 ; - %ptr = call noalias i8* @strndup(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0), i64 4) - %size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr, i1 false, i1 true, i1 false) + %ptr = call noalias ptr @strndup(ptr noundef @str, i64 4) + %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false) ret i64 %size } @@ -45,7 +45,7 @@ define dso_local i64 @check_dunder_strndup(i32 noundef %n) local_unnamed_addr { ; CHECK-LABEL: @check_dunder_strndup( ; CHECK-NEXT: ret i64 5 ; - %ptr = call noalias i8* @__strndup(i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0), i64 4) - %size = call i64 @llvm.objectsize.i64.p0i8(i8* %ptr, i1 false, i1 true, i1 false) + %ptr = call noalias ptr @__strndup(ptr noundef @str, i64 4) + %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false) ret i64 %size } diff --git a/llvm/test/Transforms/InstCombine/call-callconv-mismatch.ll b/llvm/test/Transforms/InstCombine/call-callconv-mismatch.ll index 4e27ceb194a43..cdfb16f67d59f 100644 --- a/llvm/test/Transforms/InstCombine/call-callconv-mismatch.ll +++ b/llvm/test/Transforms/InstCombine/call-callconv-mismatch.ll @@ -1,22 +1,22 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; Verify that a cdecl-compatible calling convention does not trigger emitting -; unreachable idom `store i1 true, i1* undef`. +; unreachable idom `store i1 true, ptr undef`. -define arm_aapcs_vfpcc i8 @bar(i8* %0) { +define arm_aapcs_vfpcc i8 @bar(ptr %0) { ; CHECK-LABEL: @bar( -; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[TMP0:%.*]], align 1 +; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP0:%.*]], align 1 ; CHECK-NEXT: ret i8 [[TMP2]] ; - %2 = load i8, i8* %0, align 1 + %2 = load i8, ptr %0, align 1 ret i8 %2 } -define dso_local arm_aapcs_vfpcc i8 @foo(i8* %0) { +define dso_local arm_aapcs_vfpcc i8 @foo(ptr %0) { ; CHECK-LABEL: @foo( -; CHECK-NEXT: [[TMP2:%.*]] = call i8 @bar(i8* [[TMP0:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = call i8 @bar(ptr [[TMP0:%.*]]) ; CHECK-NEXT: ret i8 [[TMP2]] ; - %2 = call i8 @bar(i8* %0) + %2 = call i8 @bar(ptr %0) ret i8 %2 } diff --git a/llvm/test/Transforms/InstCombine/call-callconv.ll b/llvm/test/Transforms/InstCombine/call-callconv.ll index e2ff6c833fb78..5b8e3e4781ebe 100644 --- a/llvm/test/Transforms/InstCombine/call-callconv.ll +++ b/llvm/test/Transforms/InstCombine/call-callconv.ll @@ -35,19 +35,19 @@ define arm_aapcscc i32 @_strlen1() { ; CHECK-LABEL: @_strlen1( ; CHECK-NEXT: ret i32 3 ; - %call = tail call arm_aapcscc i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0)) + %call = tail call arm_aapcscc i32 @strlen(ptr @.str) ret i32 %call } -declare arm_aapcscc i32 @strlen(i8*) +declare arm_aapcscc i32 @strlen(ptr) -define arm_aapcscc zeroext i1 @_strlen2(i8* %str) { +define arm_aapcscc zeroext i1 @_strlen2(ptr %str) { ; CHECK-LABEL: @_strlen2( -; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR:%.*]], align 1 +; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, ptr [[STR:%.*]], align 1 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[STRLENFIRST]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; - %call = tail call arm_aapcscc i32 @strlen(i8* %str) + %call = tail call arm_aapcscc i32 @strlen(ptr %str) %cmp = icmp ne i32 %call, 0 ret i1 %cmp } diff --git a/llvm/test/Transforms/InstCombine/call-cast-attrs.ll b/llvm/test/Transforms/InstCombine/call-cast-attrs.ll index 4fedd81981f39..0b4ce1fa293f8 100644 --- a/llvm/test/Transforms/InstCombine/call-cast-attrs.ll +++ b/llvm/test/Transforms/InstCombine/call-cast-attrs.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -passes=instcombine -data-layout="p:32:32" -S | FileCheck %s --check-prefixes=CHECK,CHECK32 ; RUN: opt < %s -passes=instcombine -data-layout="p:64:64" -S | FileCheck %s --check-prefixes=CHECK,CHECK64 -define signext i32 @b(i32* inreg %x) { +define signext i32 @b(ptr inreg %x) { ret i32 0 } @@ -16,21 +16,21 @@ define void @d(i32 %x, ...) { ret void } -define void @g(i32* %y) { - call i32 bitcast (i32 (i32*)* @b to i32 (i32)*)(i32 zeroext 0) - call void bitcast (void (...)* @c to void (i32*)*)(i32* %y) - call void bitcast (void (...)* @c to void (i32*)*)(i32* sret(i32) %y) - call void bitcast (void (i32, ...)* @d to void (i32, i32*)*)(i32 0, i32* sret(i32) %y) - call void bitcast (void (i32, ...)* @d to void (i32, i32*)*)(i32 0, i32* nocapture %y) - call void bitcast (void (i32, ...)* @d to void (i32*)*)(i32* nocapture noundef %y) +define void @g(ptr %y) { + call i32 @b(i32 zeroext 0) + call void @c(ptr %y) + call void @c(ptr sret(i32) %y) + call void @d(i32 0, ptr sret(i32) %y) + call void @d(i32 0, ptr nocapture %y) + call void @d(ptr nocapture noundef %y) ret void } -; CHECK-LABEL: define void @g(i32* %y) -; CHECK: call i32 bitcast (i32 (i32*)* @b to i32 (i32)*)(i32 zeroext 0) -; CHECK: call void (...) @c(i32* %y) -; CHECK: call void bitcast (void (...)* @c to void (i32*)*)(i32* sret(i32) %y) -; CHECK: call void bitcast (void (i32, ...)* @d to void (i32, i32*)*)(i32 0, i32* sret(i32) %y) -; CHECK: call void (i32, ...) @d(i32 0, i32* nocapture %y) -; CHECK32: %2 = ptrtoint i32* %y to i32 +; CHECK-LABEL: define void @g(ptr %y) +; CHECK: call i32 @b(i32 zeroext 0) +; CHECK: call void (...) @c(ptr %y) +; CHECK: call void @c(ptr sret(i32) %y) +; CHECK: call void @d(i32 0, ptr sret(i32) %y) +; CHECK: call void (i32, ...) @d(i32 0, ptr nocapture %y) +; CHECK32: %2 = ptrtoint ptr %y to i32 ; CHECK32: call void (i32, ...) @d(i32 noundef %2) -; CHECK64: call void bitcast (void (i32, ...)* @d to void (i32*)*)(i32* nocapture noundef %y) +; CHECK64: call void @d(ptr nocapture noundef %y) diff --git a/llvm/test/Transforms/InstCombine/call-cast-target.ll b/llvm/test/Transforms/InstCombine/call-cast-target.ll index 5f218d8e30361..26c0fc8d2cb4c 100644 --- a/llvm/test/Transforms/InstCombine/call-cast-target.ll +++ b/llvm/test/Transforms/InstCombine/call-cast-target.ll @@ -5,17 +5,17 @@ target triple = "i686-pc-linux-gnu" define i32 @main() { ; CHECK-LABEL: @main -; CHECK: %[[call:.*]] = call i8* @ctime(i32* null) -; CHECK: %[[cast:.*]] = ptrtoint i8* %[[call]] to i32 +; CHECK: %[[call:.*]] = call ptr @ctime(ptr null) +; CHECK: %[[cast:.*]] = ptrtoint ptr %[[call]] to i32 ; CHECK: ret i32 %[[cast]] entry: - %tmp = call i32 bitcast (i8* (i32*)* @ctime to i32 (i32*)*)( i32* null ) ; [#uses=1] + %tmp = call i32 @ctime( ptr null ) ; [#uses=1] ret i32 %tmp } -declare i8* @ctime(i32*) +declare ptr @ctime(ptr) -define internal { i8 } @foo(i32*) { +define internal { i8 } @foo(ptr) { entry: ret { i8 } { i8 0 } } @@ -24,66 +24,66 @@ define void @test_struct_ret() { ; CHECK-LABEL: @test_struct_ret ; CHECK-NOT: bitcast entry: - %0 = call { i8 } bitcast ({ i8 } (i32*)* @foo to { i8 } (i16*)*)(i16* null) + %0 = call { i8 } @foo(ptr null) ret void } declare i32 @fn1(i32) -define i32 @test1(i32* %a) { +define i32 @test1(ptr %a) { ; CHECK-LABEL: @test1 -; CHECK: %[[cast:.*]] = ptrtoint i32* %a to i32 +; CHECK: %[[cast:.*]] = ptrtoint ptr %a to i32 ; CHECK-NEXT: %[[call:.*]] = tail call i32 @fn1(i32 %[[cast]]) ; CHECK-NEXT: ret i32 %[[call]] entry: - %call = tail call i32 bitcast (i32 (i32)* @fn1 to i32 (i32*)*)(i32* %a) + %call = tail call i32 @fn1(ptr %a) ret i32 %call } declare i32 @fn2(i16) -define i32 @test2(i32* %a) { +define i32 @test2(ptr %a) { ; CHECK-LABEL: @test2 -; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i16)* @fn2 to i32 (i32*)*)(i32* %a) +; CHECK: %[[call:.*]] = tail call i32 @fn2(ptr %a) ; CHECK-NEXT: ret i32 %[[call]] entry: - %call = tail call i32 bitcast (i32 (i16)* @fn2 to i32 (i32*)*)(i32* %a) + %call = tail call i32 @fn2(ptr %a) ret i32 %call } declare i32 @fn3(i64) -define i32 @test3(i32* %a) { +define i32 @test3(ptr %a) { ; CHECK-LABEL: @test3 -; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i64)* @fn3 to i32 (i32*)*)(i32* %a) +; CHECK: %[[call:.*]] = tail call i32 @fn3(ptr %a) ; CHECK-NEXT: ret i32 %[[call]] entry: - %call = tail call i32 bitcast (i32 (i64)* @fn3 to i32 (i32*)*)(i32* %a) + %call = tail call i32 @fn3(ptr %a) ret i32 %call } declare i32 @fn4(i32) "thunk" -define i32 @test4(i32* %a) { +define i32 @test4(ptr %a) { ; CHECK-LABEL: @test4 -; CHECK: %[[call:.*]] = tail call i32 bitcast (i32 (i32)* @fn4 to i32 (i32*)*)(i32* %a) +; CHECK: %[[call:.*]] = tail call i32 @fn4(ptr %a) ; CHECK-NEXT: ret i32 %[[call]] entry: - %call = tail call i32 bitcast (i32 (i32)* @fn4 to i32 (i32*)*)(i32* %a) + %call = tail call i32 @fn4(ptr %a) ret i32 %call } -declare i1 @fn5({ i32, i32 }* byval({ i32, i32 }) align 4 %r) +declare i1 @fn5(ptr byval({ i32, i32 }) align 4 %r) define i1 @test5() { ; CHECK-LABEL: @test5 -; CHECK: %[[call:.*]] = call i1 bitcast (i1 ({ i32, i32 }*)* @fn5 to i1 (i32, i32)*)(i32 {{.*}}, i32 {{.*}}) +; CHECK: %[[call:.*]] = call i1 @fn5(i32 {{.*}}, i32 {{.*}}) ; CHECK-NEXT: ret i1 %[[call]] %1 = alloca { i32, i32 }, align 4 - %2 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 0 - %3 = load i32, i32* %2, align 4 - %4 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %1, i32 0, i32 1 - %5 = load i32, i32* %4, align 4 - %6 = call i1 bitcast (i1 ({ i32, i32 }*)* @fn5 to i1 (i32, i32)*)(i32 %3, i32 %5) + %2 = getelementptr inbounds { i32, i32 }, ptr %1, i32 0, i32 0 + %3 = load i32, ptr %2, align 4 + %4 = getelementptr inbounds { i32, i32 }, ptr %1, i32 0, i32 1 + %5 = load i32, ptr %4, align 4 + %6 = call i1 @fn5(i32 %3, i32 %5) ret i1 %6 } diff --git a/llvm/test/Transforms/InstCombine/call-guard.ll b/llvm/test/Transforms/InstCombine/call-guard.ll index e3f678604103f..5ed9a37981dca 100644 --- a/llvm/test/Transforms/InstCombine/call-guard.ll +++ b/llvm/test/Transforms/InstCombine/call-guard.ll @@ -60,26 +60,26 @@ define void @test_guard_adjacent_diff_cond2(i32 %V1, i32 %V2) { ; Might not be legal to hoist the load above the first guard since the ; guard might control dereferenceability -define void @negative_load(i32 %V1, i32* %P) { +define void @negative_load(i32 %V1, ptr %P) { ; CHECK-LABEL: @negative_load( ; CHECK-NEXT: [[A:%.*]] = icmp slt i32 [[V1:%.*]], 0 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[A]], i32 123) [ "deopt"() ] -; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[P:%.*]], align 4 +; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[B:%.*]] = icmp slt i32 [[V2]], 0 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[B]], i32 456) [ "deopt"() ] ; CHECK-NEXT: ret void ; %A = icmp slt i32 %V1, 0 call void(i1, ...) @llvm.experimental.guard( i1 %A, i32 123 )[ "deopt"() ] - %V2 = load i32, i32* %P + %V2 = load i32, ptr %P %B = icmp slt i32 %V2, 0 call void(i1, ...) @llvm.experimental.guard( i1 %B, i32 456 )[ "deopt"() ] ret void } -define void @deref_load(i32 %V1, i32* dereferenceable(4) align 4 %P) nofree nosync { +define void @deref_load(i32 %V1, ptr dereferenceable(4) align 4 %P) nofree nosync { ; CHECK-LABEL: @deref_load( -; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[P:%.*]], align 4 +; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[V2]], [[V1:%.*]] ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[TMP2]], i32 123) [ "deopt"() ] @@ -87,7 +87,7 @@ define void @deref_load(i32 %V1, i32* dereferenceable(4) align 4 %P) nofree nosy ; %A = icmp slt i32 %V1, 0 call void(i1, ...) @llvm.experimental.guard( i1 %A, i32 123 )[ "deopt"() ] - %V2 = load i32, i32* %P + %V2 = load i32, ptr %P %B = icmp slt i32 %V2, 0 call void(i1, ...) @llvm.experimental.guard( i1 %B, i32 456 )[ "deopt"() ] ret void diff --git a/llvm/test/Transforms/InstCombine/call-intrinsics.ll b/llvm/test/Transforms/InstCombine/call-intrinsics.ll index 0efc4b843dd5c..e821bd0deee40 100644 --- a/llvm/test/Transforms/InstCombine/call-intrinsics.ll +++ b/llvm/test/Transforms/InstCombine/call-intrinsics.ll @@ -3,17 +3,17 @@ @X = global i8 0 @Y = global i8 12 -declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i1) +declare void @llvm.memmove.p0.p0.i32(ptr, ptr, i32, i1) -declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i1) +declare void @llvm.memcpy.p0.p0.i32(ptr, ptr, i32, i1) -declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1) +declare void @llvm.memset.p0.i32(ptr, i8, i32, i1) define void @zero_byte_test() { ; These process zero bytes, so they are a noop. - call void @llvm.memmove.p0i8.p0i8.i32(i8* @X, i8* @Y, i32 0, i1 false ) - call void @llvm.memcpy.p0i8.p0i8.i32(i8* @X, i8* @Y, i32 0, i1 false ) - call void @llvm.memset.p0i8.i32(i8* @X, i8 123, i32 0, i1 false ) + call void @llvm.memmove.p0.p0.i32(ptr @X, ptr @Y, i32 0, i1 false ) + call void @llvm.memcpy.p0.p0.i32(ptr @X, ptr @Y, i32 0, i1 false ) + call void @llvm.memset.p0.i32(ptr @X, i8 123, i32 0, i1 false ) ret void } diff --git a/llvm/test/Transforms/InstCombine/call2.ll b/llvm/test/Transforms/InstCombine/call2.ll index 1e13a682a058b..90d41626ef01c 100644 --- a/llvm/test/Transforms/InstCombine/call2.ll +++ b/llvm/test/Transforms/InstCombine/call2.ll @@ -3,23 +3,23 @@ ; This used to crash trying to do a double-to-pointer conversion define i32 @bar() { entry: - %retval = alloca i32, align 4 ; [#uses=1] - %tmp = call i32 (...) bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; [#uses=0] + %retval = alloca i32, align 4 ; [#uses=1] + %tmp = call i32 (...) @f( double 3.000000e+00 ) ; [#uses=0] br label %return return: ; preds = %entry - %retval1 = load i32, i32* %retval ; [#uses=1] + %retval1 = load i32, ptr %retval ; [#uses=1] ret i32 %retval1 } -define i32 @f(i8* %p) { +define i32 @f(ptr %p) { entry: - %p_addr = alloca i8* ; [#uses=1] - %retval = alloca i32, align 4 ; [#uses=1] - store i8* %p, i8** %p_addr + %p_addr = alloca ptr ; [#uses=1] + %retval = alloca i32, align 4 ; [#uses=1] + store ptr %p, ptr %p_addr br label %return return: ; preds = %entry - %retval1 = load i32, i32* %retval ; [#uses=1] + %retval1 = load i32, ptr %retval ; [#uses=1] ret i32 %retval1 } diff --git a/llvm/test/Transforms/InstCombine/call_nonnull_arg.ll b/llvm/test/Transforms/InstCombine/call_nonnull_arg.ll index 5173c43751f37..1ca0b34e8d80a 100644 --- a/llvm/test/Transforms/InstCombine/call_nonnull_arg.ll +++ b/llvm/test/Transforms/InstCombine/call_nonnull_arg.ll @@ -2,30 +2,30 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s ; InstCombine should mark null-checked argument as nonnull at callsite -declare void @dummy(i32*, i32) +declare void @dummy(ptr, i32) -define void @test(i32* %a, i32 %b) { +define void @test(ptr %a, i32 %b) { ; CHECK-LABEL: @test( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[COND1:%.*]] = icmp eq i32* [[A:%.*]], null +; CHECK-NEXT: [[COND1:%.*]] = icmp eq ptr [[A:%.*]], null ; CHECK-NEXT: br i1 [[COND1]], label [[DEAD:%.*]], label [[NOT_NULL:%.*]] ; CHECK: not_null: ; CHECK-NEXT: [[COND2:%.*]] = icmp eq i32 [[B:%.*]], 0 ; CHECK-NEXT: br i1 [[COND2]], label [[DEAD]], label [[NOT_ZERO:%.*]] ; CHECK: not_zero: -; CHECK-NEXT: call void @dummy(i32* nonnull [[A]], i32 [[B]]) +; CHECK-NEXT: call void @dummy(ptr nonnull [[A]], i32 [[B]]) ; CHECK-NEXT: ret void ; CHECK: dead: ; CHECK-NEXT: unreachable ; entry: - %cond1 = icmp eq i32* %a, null + %cond1 = icmp eq ptr %a, null br i1 %cond1, label %dead, label %not_null not_null: %cond2 = icmp eq i32 %b, 0 br i1 %cond2, label %dead, label %not_zero not_zero: - call void @dummy(i32* %a, i32 %b) + call void @dummy(ptr %a, i32 %b) ret void dead: unreachable @@ -34,30 +34,30 @@ dead: ; The nonnull attribute in the 'bar' declaration is ; propagated to the parameters of the 'baz' callsite. -declare void @bar(i8*, i8* nonnull noundef) -declare void @bar_without_noundef(i8*, i8* nonnull) -declare void @baz(i8*, i8*) +declare void @bar(ptr, ptr nonnull noundef) +declare void @bar_without_noundef(ptr, ptr nonnull) +declare void @baz(ptr, ptr) -define void @deduce_nonnull_from_another_call(i8* %a, i8* %b) { +define void @deduce_nonnull_from_another_call(ptr %a, ptr %b) { ; CHECK-LABEL: @deduce_nonnull_from_another_call( -; CHECK-NEXT: call void @bar(i8* [[A:%.*]], i8* [[B:%.*]]) -; CHECK-NEXT: call void @baz(i8* nonnull [[B]], i8* nonnull [[B]]) +; CHECK-NEXT: call void @bar(ptr [[A:%.*]], ptr [[B:%.*]]) +; CHECK-NEXT: call void @baz(ptr nonnull [[B]], ptr nonnull [[B]]) ; CHECK-NEXT: ret void ; - call void @bar(i8* %a, i8* %b) - call void @baz(i8* %b, i8* %b) + call void @bar(ptr %a, ptr %b) + call void @baz(ptr %b, ptr %b) ret void } -define void @deduce_nonnull_from_another_call2(i8* %a, i8* %b) { +define void @deduce_nonnull_from_another_call2(ptr %a, ptr %b) { ; CHECK-LABEL: @deduce_nonnull_from_another_call2( -; CHECK-NEXT: call void @bar_without_noundef(i8* [[A:%.*]], i8* [[B:%.*]]) -; CHECK-NEXT: call void @baz(i8* [[B]], i8* [[B]]) +; CHECK-NEXT: call void @bar_without_noundef(ptr [[A:%.*]], ptr [[B:%.*]]) +; CHECK-NEXT: call void @baz(ptr [[B]], ptr [[B]]) ; CHECK-NEXT: ret void ; - call void @bar_without_noundef(i8* %a, i8* %b) - call void @baz(i8* %b, i8* %b) + call void @bar_without_noundef(ptr %a, ptr %b) + call void @baz(ptr %b, ptr %b) ret void } diff --git a/llvm/test/Transforms/InstCombine/calloc-mismatch.ll b/llvm/test/Transforms/InstCombine/calloc-mismatch.ll index b8d3bbc30a1c1..c51b4a9812c22 100644 --- a/llvm/test/Transforms/InstCombine/calloc-mismatch.ll +++ b/llvm/test/Transforms/InstCombine/calloc-mismatch.ll @@ -4,13 +4,13 @@ ; The argument types should match if it is the standard library calloc. ; Don't crash analyzing an imposter. -declare i8* @calloc(i64, i32) +declare ptr @calloc(i64, i32) define void @PR50846() { ; CHECK-LABEL: @PR50846( -; CHECK-NEXT: [[CALL:%.*]] = call i8* @calloc(i64 1, i32 1) +; CHECK-NEXT: [[CALL:%.*]] = call ptr @calloc(i64 1, i32 1) ; CHECK-NEXT: ret void ; - %call = call i8* @calloc(i64 1, i32 1) + %call = call ptr @calloc(i64 1, i32 1) ret void } diff --git a/llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll b/llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll index a7600665adbdd..4547008b76093 100644 --- a/llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll +++ b/llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll @@ -383,17 +383,17 @@ define <3 x i32> @t21_ult_slt_vec_undef2(<3 x i32> %x, <3 x i32> %replacement_lo ;------------------------------------------------------------------------------- -define i32* @t22_pointers(i32* %x, i32* %replacement_low, i32* %replacement_high) { +define ptr @t22_pointers(ptr %x, ptr %replacement_low, ptr %replacement_high) { ; CHECK-LABEL: @t22_pointers( -; CHECK-NEXT: [[T0:%.*]] = icmp slt i32* [[X:%.*]], inttoptr (i64 65536 to i32*) -; CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32* [[REPLACEMENT_LOW:%.*]], i32* [[REPLACEMENT_HIGH:%.*]] -; CHECK-NEXT: [[T2:%.*]] = icmp ult i32* [[X]], inttoptr (i64 65536 to i32*) -; CHECK-NEXT: [[R:%.*]] = select i1 [[T2]], i32* [[X]], i32* [[T1]] -; CHECK-NEXT: ret i32* [[R]] +; CHECK-NEXT: [[T0:%.*]] = icmp slt ptr [[X:%.*]], inttoptr (i64 65536 to ptr) +; CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], ptr [[REPLACEMENT_LOW:%.*]], ptr [[REPLACEMENT_HIGH:%.*]] +; CHECK-NEXT: [[T2:%.*]] = icmp ult ptr [[X]], inttoptr (i64 65536 to ptr) +; CHECK-NEXT: [[R:%.*]] = select i1 [[T2]], ptr [[X]], ptr [[T1]] +; CHECK-NEXT: ret ptr [[R]] ; - %t0 = icmp slt i32* %x, inttoptr (i64 65536 to i32*) - %t1 = select i1 %t0, i32* %replacement_low, i32* %replacement_high - %t2 = icmp ult i32* %x, inttoptr (i64 65536 to i32*) - %r = select i1 %t2, i32* %x, i32* %t1 - ret i32* %r + %t0 = icmp slt ptr %x, inttoptr (i64 65536 to ptr) + %t1 = select i1 %t0, ptr %replacement_low, ptr %replacement_high + %t2 = icmp ult ptr %x, inttoptr (i64 65536 to ptr) + %r = select i1 %t2, ptr %x, ptr %t1 + ret ptr %r } diff --git a/llvm/test/Transforms/InstCombine/canonicalize-selects-icmp-condition-bittest.ll b/llvm/test/Transforms/InstCombine/canonicalize-selects-icmp-condition-bittest.ll index dd8385764cc4a..27b29a879ea72 100644 --- a/llvm/test/Transforms/InstCombine/canonicalize-selects-icmp-condition-bittest.ll +++ b/llvm/test/Transforms/InstCombine/canonicalize-selects-icmp-condition-bittest.ll @@ -47,7 +47,7 @@ define i8 @n2(i8 %x, i8 %v0, i8 %v1) { } ; Extra use can be adjusted. While there, test multi-bb case. -define i8 @t3(i8 %x, i8 %v0, i8 %v1, i8 %v2, i8 %v3, i8* %out, i1 %c) { +define i8 @t3(i8 %x, i8 %v0, i8 %v1, i8 %v2, i8 %v3, ptr %out, i1 %c) { ; CHECK-LABEL: @t3( ; CHECK-NEXT: bb0: ; CHECK-NEXT: [[T0:%.*]] = and i8 [[X:%.*]], 1 @@ -55,7 +55,7 @@ define i8 @t3(i8 %x, i8 %v0, i8 %v1, i8 %v2, i8 %v3, i8* %out, i1 %c) { ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: ; CHECK-NEXT: [[R0:%.*]] = select i1 [[T1_NOT]], i8 [[V1:%.*]], i8 [[V0:%.*]] -; CHECK-NEXT: store i8 [[R0]], i8* [[OUT:%.*]], align 1 +; CHECK-NEXT: store i8 [[R0]], ptr [[OUT:%.*]], align 1 ; CHECK-NEXT: br label [[BB2]] ; CHECK: bb2: ; CHECK-NEXT: [[R1:%.*]] = select i1 [[T1_NOT]], i8 [[V3:%.*]], i8 [[V2:%.*]] @@ -67,25 +67,25 @@ bb0: br i1 %c, label %bb1, label %bb2 bb1: %r0 = select i1 %t1, i8 %v0, i8 %v1 - store i8 %r0, i8* %out + store i8 %r0, ptr %out br label %bb2 bb2: %r1 = select i1 %t1, i8 %v2, i8 %v3 ret i8 %r1 } -define i8 @t4(i8 %x, i8 %v0, i8 %v1, i8 %v2, i8 %v3, i8* %out) { +define i8 @t4(i8 %x, i8 %v0, i8 %v1, i8 %v2, i8 %v3, ptr %out) { ; CHECK-LABEL: @t4( ; CHECK-NEXT: [[T0:%.*]] = and i8 [[X:%.*]], 1 ; CHECK-NEXT: [[T1_NOT:%.*]] = icmp eq i8 [[T0]], 0 ; CHECK-NEXT: [[R0:%.*]] = select i1 [[T1_NOT]], i8 [[V1:%.*]], i8 [[V0:%.*]] -; CHECK-NEXT: store i8 [[R0]], i8* [[OUT:%.*]], align 1 +; CHECK-NEXT: store i8 [[R0]], ptr [[OUT:%.*]], align 1 ; CHECK-NEXT: [[R1:%.*]] = select i1 [[T1_NOT]], i8 [[V3:%.*]], i8 [[V2:%.*]] ; CHECK-NEXT: ret i8 [[R1]] ; %t0 = and i8 %x, 1 %t1 = icmp ne i8 %t0, 0 %r0 = select i1 %t1, i8 %v0, i8 %v1 - store i8 %r0, i8* %out + store i8 %r0, ptr %out %r1 = select i1 %t1, i8 %v2, i8 %v3 ret i8 %r1 } diff --git a/llvm/test/Transforms/InstCombine/cast-call-combine-prof.ll b/llvm/test/Transforms/InstCombine/cast-call-combine-prof.ll index f5be73f9c049c..51d9bf852ead0 100644 --- a/llvm/test/Transforms/InstCombine/cast-call-combine-prof.ll +++ b/llvm/test/Transforms/InstCombine/cast-call-combine-prof.ll @@ -4,31 +4,31 @@ ; prototype casts. declare i32 @__gxx_personality_v0(...) -declare void @__cxa_call_unexpected(i8*) -declare void @foo(i16* %a) +declare void @__cxa_call_unexpected(ptr) +declare void @foo(ptr %a) ; CHECK-LABEL: @test_call() -; CHECK: call void @foo(i16* null), !prof ![[$PROF:[0-9]+]] +; CHECK: call void @foo(ptr null), !prof ![[$PROF:[0-9]+]] define void @test_call() { - call void bitcast (void (i16*)* @foo to void (i8*)*) (i8* null), !prof !0 + call void @foo (ptr null), !prof !0 ret void } ; CHECK-LABEL: @test_invoke() -; CHECK: invoke void @foo(i16* null) +; CHECK: invoke void @foo(ptr null) ; CHECK-NEXT: to label %done unwind label %lpad, !prof ![[$PROF]] -define void @test_invoke() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { - invoke void bitcast (void (i16*)* @foo to void (i8*)*) (i8* null) +define void @test_invoke() personality ptr @__gxx_personality_v0 { + invoke void @foo (ptr null) to label %done unwind label %lpad, !prof !0 done: ret void lpad: - %lp = landingpad { i8*, i32 } - filter [0 x i8*] zeroinitializer - %ehptr = extractvalue { i8*, i32 } %lp, 0 - tail call void @__cxa_call_unexpected(i8* %ehptr) noreturn nounwind + %lp = landingpad { ptr, i32 } + filter [0 x ptr] zeroinitializer + %ehptr = extractvalue { ptr, i32 } %lp, 0 + tail call void @__cxa_call_unexpected(ptr %ehptr) noreturn nounwind unreachable } diff --git a/llvm/test/Transforms/InstCombine/cast-call-combine.ll b/llvm/test/Transforms/InstCombine/cast-call-combine.ll index bf70811b6c4bb..41bc15ea1e7fb 100644 --- a/llvm/test/Transforms/InstCombine/cast-call-combine.ll +++ b/llvm/test/Transforms/InstCombine/cast-call-combine.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -instcombine -always-inline -S | FileCheck %s -define internal void @foo(i16*) alwaysinline { +define internal void @foo(ptr) alwaysinline { ret void } @@ -17,7 +17,7 @@ then: else: ; CHECK-NOT: call - call void bitcast (void (i16*)* @foo to void (i8*)*) (i8* null) + call void @foo (ptr null) ret void } diff --git a/llvm/test/Transforms/InstCombine/cast-callee-deopt-bundles.ll b/llvm/test/Transforms/InstCombine/cast-callee-deopt-bundles.ll index af8f6376756b4..14ff3ee71094f 100644 --- a/llvm/test/Transforms/InstCombine/cast-callee-deopt-bundles.ll +++ b/llvm/test/Transforms/InstCombine/cast-callee-deopt-bundles.ll @@ -6,6 +6,6 @@ define void @g() { ; CHECK-LABEL: @g( entry: ; CHECK: call void @foo(i32 0) [ "deopt"() ] - call void bitcast (void (i32)* @foo to void ()*) () [ "deopt"() ] + call void @foo () [ "deopt"() ] ret void } diff --git a/llvm/test/Transforms/InstCombine/cast-set.ll b/llvm/test/Transforms/InstCombine/cast-set.ll index 438ddce84b650..a86804d9d703e 100644 --- a/llvm/test/Transforms/InstCombine/cast-set.ll +++ b/llvm/test/Transforms/InstCombine/cast-set.ll @@ -66,12 +66,11 @@ define i1 @test6a(i1 %A) { ret i1 %C } -define i1 @test7(i8* %A) { +define i1 @test7(ptr %A) { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[C:%.*]] = icmp eq i8* %A, null +; CHECK-NEXT: [[C:%.*]] = icmp eq ptr %A, null ; CHECK-NEXT: ret i1 [[C]] ; - %B = bitcast i8* %A to i32* - %C = icmp eq i32* %B, null + %C = icmp eq ptr %A, null ret i1 %C } diff --git a/llvm/test/Transforms/InstCombine/cast_phi.ll b/llvm/test/Transforms/InstCombine/cast_phi.ll index d47526e088386..afc52f02b6a28 100644 --- a/llvm/test/Transforms/InstCombine/cast_phi.ll +++ b/llvm/test/Transforms/InstCombine/cast_phi.ll @@ -10,17 +10,17 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { ; CHECK-NEXT: [[CALLB:%.*]] = alloca [258 x float], align 4 ; CHECK-NEXT: [[CONV_I:%.*]] = uitofp i32 [[INUMSTEPS:%.*]] to float ; CHECK-NEXT: [[CONV_I12:%.*]] = zext i32 [[TID:%.*]] to i64 -; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLA]], i64 0, i64 [[CONV_I12]] -; CHECK-NEXT: store float [[CONV_I]], float* [[ARRAYIDX3]], align 4 -; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLB]], i64 0, i64 [[CONV_I12]] -; CHECK-NEXT: store float [[CONV_I]], float* [[ARRAYIDX6]], align 4 +; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLA]], i64 0, i64 [[CONV_I12]] +; CHECK-NEXT: store float [[CONV_I]], ptr [[ARRAYIDX3]], align 4 +; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLB]], i64 0, i64 [[CONV_I12]] +; CHECK-NEXT: store float [[CONV_I]], ptr [[ARRAYIDX6]], align 4 ; CHECK-NEXT: [[CMP7:%.*]] = icmp eq i32 [[TID]], 0 ; CHECK-NEXT: br i1 [[CMP7]], label [[DOTBB1:%.*]], label [[DOTBB2:%.*]] ; CHECK: .bb1: -; CHECK-NEXT: [[ARRAYIDX10:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLA]], i64 0, i64 256 -; CHECK-NEXT: store float [[CONV_I]], float* [[ARRAYIDX10]], align 4 -; CHECK-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLB]], i64 0, i64 256 -; CHECK-NEXT: store float 0.000000e+00, float* [[ARRAYIDX11]], align 4 +; CHECK-NEXT: [[ARRAYIDX10:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLA]], i64 0, i64 256 +; CHECK-NEXT: store float [[CONV_I]], ptr [[ARRAYIDX10]], align 4 +; CHECK-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLB]], i64 0, i64 256 +; CHECK-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX11]], align 4 ; CHECK-NEXT: br label [[DOTBB2]] ; CHECK: .bb2: ; CHECK-NEXT: [[CMP135:%.*]] = icmp sgt i32 [[INUMSTEPS]], 0 @@ -32,13 +32,13 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { ; CHECK-NEXT: [[TMP3:%.*]] = icmp ugt i32 [[I12_06]], [[BASE:%.*]] ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[I12_06]], 1 ; CHECK-NEXT: [[CONV_I9:%.*]] = sext i32 [[ADD]] to i64 -; CHECK-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLA]], i64 0, i64 [[CONV_I9]] -; CHECK-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds [258 x float], [258 x float]* [[CALLB]], i64 0, i64 [[CONV_I9]] +; CHECK-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLA]], i64 0, i64 [[CONV_I9]] +; CHECK-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds [258 x float], ptr [[CALLB]], i64 0, i64 [[CONV_I9]] ; CHECK-NEXT: [[CMP40:%.*]] = icmp ult i32 [[I12_06]], [[BASE]] ; CHECK-NEXT: br i1 [[TMP3]], label [[DOTBB4:%.*]], label [[DOTBB5:%.*]] ; CHECK: .bb4: -; CHECK-NEXT: [[TMP4:%.*]] = load float, float* [[ARRAYIDX20]], align 4 -; CHECK-NEXT: [[TMP5:%.*]] = load float, float* [[ARRAYIDX24]], align 4 +; CHECK-NEXT: [[TMP4:%.*]] = load float, ptr [[ARRAYIDX20]], align 4 +; CHECK-NEXT: [[TMP5:%.*]] = load float, ptr [[ARRAYIDX24]], align 4 ; CHECK-NEXT: [[ADD33:%.*]] = fadd float [[TMP5]], [[TMP4]] ; CHECK-NEXT: [[ADD33_1:%.*]] = fadd float [[ADD33]], [[TMP1]] ; CHECK-NEXT: [[ADD33_2:%.*]] = fadd float [[ADD33_1]], [[TMP2]] @@ -48,16 +48,16 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { ; CHECK-NEXT: [[TMP7:%.*]] = phi float [ [[ADD33_2]], [[DOTBB4]] ], [ [[TMP2]], [[DOTBB3]] ] ; CHECK-NEXT: br i1 [[CMP40]], label [[DOTBB6:%.*]], label [[DOTBB7:%.*]] ; CHECK: .bb6: -; CHECK-NEXT: store float [[TMP7]], float* [[ARRAYIDX3]], align 4 -; CHECK-NEXT: store float [[TMP6]], float* [[ARRAYIDX6]], align 4 +; CHECK-NEXT: store float [[TMP7]], ptr [[ARRAYIDX3]], align 4 +; CHECK-NEXT: store float [[TMP6]], ptr [[ARRAYIDX6]], align 4 ; CHECK-NEXT: br label [[DOTBB7]] ; CHECK: .bb7: ; CHECK-NEXT: br i1 [[TMP3]], label [[DOTBB9:%.*]], label [[DOTBB10:%.*]] ; CHECK: .bb8: ; CHECK-NEXT: ret void ; CHECK: .bb9: -; CHECK-NEXT: [[TMP8:%.*]] = load float, float* [[ARRAYIDX20]], align 4 -; CHECK-NEXT: [[TMP9:%.*]] = load float, float* [[ARRAYIDX24]], align 4 +; CHECK-NEXT: [[TMP8:%.*]] = load float, ptr [[ARRAYIDX20]], align 4 +; CHECK-NEXT: [[TMP9:%.*]] = load float, ptr [[ARRAYIDX24]], align 4 ; CHECK-NEXT: [[ADD33_112:%.*]] = fadd float [[TMP9]], [[TMP8]] ; CHECK-NEXT: [[ADD33_1_1:%.*]] = fadd float [[ADD33_112]], [[TMP6]] ; CHECK-NEXT: [[ADD33_2_1:%.*]] = fadd float [[ADD33_1_1]], [[TMP7]] @@ -67,8 +67,8 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { ; CHECK-NEXT: [[TMP11]] = phi float [ [[ADD33_2_1]], [[DOTBB9]] ], [ [[TMP7]], [[DOTBB7]] ] ; CHECK-NEXT: br i1 [[CMP40]], label [[DOTBB11:%.*]], label [[DOTBB12]] ; CHECK: .bb11: -; CHECK-NEXT: store float [[TMP11]], float* [[ARRAYIDX3]], align 4 -; CHECK-NEXT: store float [[TMP10]], float* [[ARRAYIDX6]], align 4 +; CHECK-NEXT: store float [[TMP11]], ptr [[ARRAYIDX3]], align 4 +; CHECK-NEXT: store float [[TMP10]], ptr [[ARRAYIDX6]], align 4 ; CHECK-NEXT: br label [[DOTBB12]] ; CHECK: .bb12: ; CHECK-NEXT: [[SUB]] = add i32 [[I12_06]], -4 @@ -80,20 +80,18 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { %conv.i = uitofp i32 %iNumSteps to float %1 = bitcast float %conv.i to i32 %conv.i12 = zext i32 %tid to i64 - %arrayidx3 = getelementptr inbounds [258 x float], [258 x float]* %callA, i64 0, i64 %conv.i12 - %2 = bitcast float* %arrayidx3 to i32* - store i32 %1, i32* %2, align 4 - %arrayidx6 = getelementptr inbounds [258 x float], [258 x float]* %callB, i64 0, i64 %conv.i12 - %3 = bitcast float* %arrayidx6 to i32* - store i32 %1, i32* %3, align 4 + %arrayidx3 = getelementptr inbounds [258 x float], ptr %callA, i64 0, i64 %conv.i12 + store i32 %1, ptr %arrayidx3, align 4 + %arrayidx6 = getelementptr inbounds [258 x float], ptr %callB, i64 0, i64 %conv.i12 + store i32 %1, ptr %arrayidx6, align 4 %cmp7 = icmp eq i32 %tid, 0 br i1 %cmp7, label %.bb1, label %.bb2 .bb1: - %arrayidx10 = getelementptr inbounds [258 x float], [258 x float]* %callA, i64 0, i64 256 - store float %conv.i, float* %arrayidx10, align 4 - %arrayidx11 = getelementptr inbounds [258 x float], [258 x float]* %callB, i64 0, i64 256 - store float 0.000000e+00, float* %arrayidx11, align 4 + %arrayidx10 = getelementptr inbounds [258 x float], ptr %callA, i64 0, i64 256 + store float %conv.i, ptr %arrayidx10, align 4 + %arrayidx11 = getelementptr inbounds [258 x float], ptr %callB, i64 0, i64 256 + store float 0.000000e+00, ptr %arrayidx11, align 4 br label %.bb2 .bb2: @@ -104,68 +102,66 @@ define void @MainKernel(i32 %iNumSteps, i32 %tid, i32 %base) { %rA.sroa.8.0 = phi i32 [ %rA.sroa.8.2, %.bb12 ], [ %1, %.bb2 ] %rA.sroa.0.0 = phi i32 [ %rA.sroa.0.2, %.bb12 ], [ %1, %.bb2 ] %i12.06 = phi i32 [ %sub, %.bb12 ], [ %iNumSteps, %.bb2 ] - %4 = icmp ugt i32 %i12.06, %base + %2 = icmp ugt i32 %i12.06, %base %add = add i32 %i12.06, 1 %conv.i9 = sext i32 %add to i64 - %arrayidx20 = getelementptr inbounds [258 x float], [258 x float]* %callA, i64 0, i64 %conv.i9 - %5 = bitcast float* %arrayidx20 to i32* - %arrayidx24 = getelementptr inbounds [258 x float], [258 x float]* %callB, i64 0, i64 %conv.i9 - %6 = bitcast float* %arrayidx24 to i32* + %arrayidx20 = getelementptr inbounds [258 x float], ptr %callA, i64 0, i64 %conv.i9 + %arrayidx24 = getelementptr inbounds [258 x float], ptr %callB, i64 0, i64 %conv.i9 %cmp40 = icmp ult i32 %i12.06, %base - br i1 %4, label %.bb4, label %.bb5 + br i1 %2, label %.bb4, label %.bb5 .bb4: - %7 = load i32, i32* %5, align 4 - %8 = load i32, i32* %6, align 4 - %9 = bitcast i32 %8 to float - %10 = bitcast i32 %7 to float - %add33 = fadd float %9, %10 - %11 = bitcast i32 %rA.sroa.8.0 to float - %add33.1 = fadd float %add33, %11 - %12 = bitcast float %add33.1 to i32 - %13 = bitcast i32 %rA.sroa.0.0 to float - %add33.2 = fadd float %add33.1, %13 - %14 = bitcast float %add33.2 to i32 + %3 = load i32, ptr %arrayidx20, align 4 + %4 = load i32, ptr %arrayidx24, align 4 + %5 = bitcast i32 %4 to float + %6 = bitcast i32 %3 to float + %add33 = fadd float %5, %6 + %7 = bitcast i32 %rA.sroa.8.0 to float + %add33.1 = fadd float %add33, %7 + %8 = bitcast float %add33.1 to i32 + %9 = bitcast i32 %rA.sroa.0.0 to float + %add33.2 = fadd float %add33.1, %9 + %10 = bitcast float %add33.2 to i32 br label %.bb5 .bb5: - %rA.sroa.8.1 = phi i32 [ %12, %.bb4 ], [ %rA.sroa.8.0, %.bb3 ] - %rA.sroa.0.1 = phi i32 [ %14, %.bb4 ], [ %rA.sroa.0.0, %.bb3 ] + %rA.sroa.8.1 = phi i32 [ %8, %.bb4 ], [ %rA.sroa.8.0, %.bb3 ] + %rA.sroa.0.1 = phi i32 [ %10, %.bb4 ], [ %rA.sroa.0.0, %.bb3 ] br i1 %cmp40, label %.bb6, label %.bb7 .bb6: - store i32 %rA.sroa.0.1, i32* %2, align 4 - store i32 %rA.sroa.8.1, i32* %3, align 4 + store i32 %rA.sroa.0.1, ptr %arrayidx3, align 4 + store i32 %rA.sroa.8.1, ptr %arrayidx6, align 4 br label %.bb7 .bb7: - br i1 %4, label %.bb9, label %.bb10 + br i1 %2, label %.bb9, label %.bb10 .bb8: ret void .bb9: - %15 = load i32, i32* %5, align 4 - %16 = load i32, i32* %6, align 4 - %17 = bitcast i32 %16 to float - %18 = bitcast i32 %15 to float - %add33.112 = fadd float %17, %18 - %19 = bitcast i32 %rA.sroa.8.1 to float - %add33.1.1 = fadd float %add33.112, %19 - %20 = bitcast float %add33.1.1 to i32 - %21 = bitcast i32 %rA.sroa.0.1 to float - %add33.2.1 = fadd float %add33.1.1, %21 - %22 = bitcast float %add33.2.1 to i32 + %11 = load i32, ptr %arrayidx20, align 4 + %12 = load i32, ptr %arrayidx24, align 4 + %13 = bitcast i32 %12 to float + %14 = bitcast i32 %11 to float + %add33.112 = fadd float %13, %14 + %15 = bitcast i32 %rA.sroa.8.1 to float + %add33.1.1 = fadd float %add33.112, %15 + %16 = bitcast float %add33.1.1 to i32 + %17 = bitcast i32 %rA.sroa.0.1 to float + %add33.2.1 = fadd float %add33.1.1, %17 + %18 = bitcast float %add33.2.1 to i32 br label %.bb10 .bb10: - %rA.sroa.8.2 = phi i32 [ %20, %.bb9 ], [ %rA.sroa.8.1, %.bb7 ] - %rA.sroa.0.2 = phi i32 [ %22, %.bb9 ], [ %rA.sroa.0.1, %.bb7 ] + %rA.sroa.8.2 = phi i32 [ %16, %.bb9 ], [ %rA.sroa.8.1, %.bb7 ] + %rA.sroa.0.2 = phi i32 [ %18, %.bb9 ], [ %rA.sroa.0.1, %.bb7 ] br i1 %cmp40, label %.bb11, label %.bb12 .bb11: - store i32 %rA.sroa.0.2, i32* %2, align 4 - store i32 %rA.sroa.8.2, i32* %3, align 4 + store i32 %rA.sroa.0.2, ptr %arrayidx3, align 4 + store i32 %rA.sroa.8.2, ptr %arrayidx6, align 4 br label %.bb12 .bb12: diff --git a/llvm/test/Transforms/InstCombine/cast_ptr.ll b/llvm/test/Transforms/InstCombine/cast_ptr.ll index 234644ab01fb9..5c6c012064e05 100644 --- a/llvm/test/Transforms/InstCombine/cast_ptr.ll +++ b/llvm/test/Transforms/InstCombine/cast_ptr.ll @@ -10,96 +10,96 @@ target datalayout = "p:32:32-p1:32:32-p2:16:16" ; between the arithmetic and the layout of allocated memory is ; entirely unknown. -define i8* @test1(i8* %t) { +define ptr @test1(ptr %t) { ; CHECK-LABEL: @test1( -; CHECK-NEXT: [[TC:%.*]] = ptrtoint i8* [[T:%.*]] to i32 +; CHECK-NEXT: [[TC:%.*]] = ptrtoint ptr [[T:%.*]] to i32 ; CHECK-NEXT: [[TA:%.*]] = add i32 [[TC]], 32 -; CHECK-NEXT: [[TV:%.*]] = inttoptr i32 [[TA]] to i8* -; CHECK-NEXT: ret i8* [[TV]] +; CHECK-NEXT: [[TV:%.*]] = inttoptr i32 [[TA]] to ptr +; CHECK-NEXT: ret ptr [[TV]] ; - %tc = ptrtoint i8* %t to i32 + %tc = ptrtoint ptr %t to i32 %ta = add i32 %tc, 32 - %tv = inttoptr i32 %ta to i8* - ret i8* %tv + %tv = inttoptr i32 %ta to ptr + ret ptr %tv } ; These casts should be folded away. -define i1 @test2(i8* %a, i8* %b) { +define i1 @test2(ptr %a, ptr %b) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[R:%.*]] = icmp eq ptr [[A:%.*]], [[B:%.*]] ; CHECK-NEXT: ret i1 [[R]] ; - %ta = ptrtoint i8* %a to i32 - %tb = ptrtoint i8* %b to i32 + %ta = ptrtoint ptr %a to i32 + %tb = ptrtoint ptr %b to i32 %r = icmp eq i32 %ta, %tb ret i1 %r } ; These casts should be folded away. -define i1 @test2_as2_same_int(i8 addrspace(2)* %a, i8 addrspace(2)* %b) { +define i1 @test2_as2_same_int(ptr addrspace(2) %a, ptr addrspace(2) %b) { ; CHECK-LABEL: @test2_as2_same_int( -; CHECK-NEXT: [[R:%.*]] = icmp eq i8 addrspace(2)* [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[R:%.*]] = icmp eq ptr addrspace(2) [[A:%.*]], [[B:%.*]] ; CHECK-NEXT: ret i1 [[R]] ; - %ta = ptrtoint i8 addrspace(2)* %a to i16 - %tb = ptrtoint i8 addrspace(2)* %b to i16 + %ta = ptrtoint ptr addrspace(2) %a to i16 + %tb = ptrtoint ptr addrspace(2) %b to i16 %r = icmp eq i16 %ta, %tb ret i1 %r } ; These casts should be folded away. -define i1 @test2_as2_larger(i8 addrspace(2)* %a, i8 addrspace(2)* %b) { +define i1 @test2_as2_larger(ptr addrspace(2) %a, ptr addrspace(2) %b) { ; CHECK-LABEL: @test2_as2_larger( -; CHECK-NEXT: [[R:%.*]] = icmp eq i8 addrspace(2)* [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[R:%.*]] = icmp eq ptr addrspace(2) [[A:%.*]], [[B:%.*]] ; CHECK-NEXT: ret i1 [[R]] ; - %ta = ptrtoint i8 addrspace(2)* %a to i32 - %tb = ptrtoint i8 addrspace(2)* %b to i32 + %ta = ptrtoint ptr addrspace(2) %a to i32 + %tb = ptrtoint ptr addrspace(2) %b to i32 %r = icmp eq i32 %ta, %tb ret i1 %r } ; These casts should not be folded away. -define i1 @test2_diff_as(i8* %p, i8 addrspace(1)* %q) { +define i1 @test2_diff_as(ptr %p, ptr addrspace(1) %q) { ; CHECK-LABEL: @test2_diff_as( -; CHECK-NEXT: [[I0:%.*]] = ptrtoint i8* [[P:%.*]] to i32 -; CHECK-NEXT: [[I1:%.*]] = ptrtoint i8 addrspace(1)* [[Q:%.*]] to i32 +; CHECK-NEXT: [[I0:%.*]] = ptrtoint ptr [[P:%.*]] to i32 +; CHECK-NEXT: [[I1:%.*]] = ptrtoint ptr addrspace(1) [[Q:%.*]] to i32 ; CHECK-NEXT: [[R0:%.*]] = icmp sge i32 [[I0]], [[I1]] ; CHECK-NEXT: ret i1 [[R0]] ; - %i0 = ptrtoint i8* %p to i32 - %i1 = ptrtoint i8 addrspace(1)* %q to i32 + %i0 = ptrtoint ptr %p to i32 + %i1 = ptrtoint ptr addrspace(1) %q to i32 %r0 = icmp sge i32 %i0, %i1 ret i1 %r0 } ; These casts should not be folded away. -define i1 @test2_diff_as_global(i8 addrspace(1)* %q) { +define i1 @test2_diff_as_global(ptr addrspace(1) %q) { ; CHECK-LABEL: @test2_diff_as_global( -; CHECK-NEXT: [[I1:%.*]] = ptrtoint i8 addrspace(1)* [[Q:%.*]] to i32 -; CHECK-NEXT: [[R0:%.*]] = icmp sge i32 [[I1]], ptrtoint (i8* @global to i32) +; CHECK-NEXT: [[I1:%.*]] = ptrtoint ptr addrspace(1) [[Q:%.*]] to i32 +; CHECK-NEXT: [[R0:%.*]] = icmp sge i32 [[I1]], ptrtoint (ptr @global to i32) ; CHECK-NEXT: ret i1 [[R0]] ; - %i0 = ptrtoint i8* @global to i32 - %i1 = ptrtoint i8 addrspace(1)* %q to i32 + %i0 = ptrtoint ptr @global to i32 + %i1 = ptrtoint ptr addrspace(1) %q to i32 %r0 = icmp sge i32 %i1, %i0 ret i1 %r0 } ; These casts should also be folded away. -define i1 @test3(i8* %a) { +define i1 @test3(ptr %a) { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A:%.*]], @global +; CHECK-NEXT: [[R:%.*]] = icmp eq ptr [[A:%.*]], @global ; CHECK-NEXT: ret i1 [[R]] ; - %ta = ptrtoint i8* %a to i32 - %r = icmp eq i32 %ta, ptrtoint (i8* @global to i32) + %ta = ptrtoint ptr %a to i32 + %r = icmp eq i32 %ta, ptrtoint (ptr @global to i32) ret i1 %r } @@ -108,8 +108,8 @@ define i1 @test4(i32 %A) { ; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[A:%.*]], 0 ; CHECK-NEXT: ret i1 [[C]] ; - %B = inttoptr i32 %A to i8* - %C = icmp eq i8* %B, null + %B = inttoptr i32 %A to ptr + %C = icmp eq ptr %B, null ret i1 %C } @@ -118,8 +118,8 @@ define i1 @test4_as2(i16 %A) { ; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[A:%.*]], 0 ; CHECK-NEXT: ret i1 [[C]] ; - %B = inttoptr i16 %A to i8 addrspace(2)* - %C = icmp eq i8 addrspace(2)* %B, null + %B = inttoptr i16 %A to ptr addrspace(2) + %C = icmp eq ptr addrspace(2) %B, null ret i1 %C } @@ -129,19 +129,18 @@ define i1 @test4_as2(i16 %A) { %op = type { float } %unop = type { i32 } -@Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* @foo ] +@Array = internal constant [1 x ptr] [ ptr @foo ] -declare %op* @foo(%op* %X) +declare ptr @foo(ptr %X) -define %unop* @test5(%op* %O) { +define ptr @test5(ptr %O) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: [[T_2:%.*]] = call %op* @foo(%op* [[O:%.*]]) -; CHECK-NEXT: [[TMP1:%.*]] = bitcast %op* [[T_2]] to %unop* -; CHECK-NEXT: ret %unop* [[TMP1]] +; CHECK-NEXT: [[T_2:%.*]] = call ptr @foo(ptr [[O:%.*]]) +; CHECK-NEXT: ret ptr [[T_2]] ; - %t = load %unop* (%op*)*, %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1] - %t.2 = call %unop* %t( %op* %O ) - ret %unop* %t.2 + %t = load ptr, ptr @Array; [#uses=1] + %t.2 = call ptr %t( ptr %O ) + ret ptr %t.2 } @@ -149,99 +148,99 @@ define %unop* @test5(%op* %O) { ; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes ; the address space. -define i8 @test6(i8 addrspace(1)* %source) { +define i8 @test6(ptr addrspace(1) %source) { ; CHECK-LABEL: @test6( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[ARRAYIDX223:%.*]] = addrspacecast i8 addrspace(1)* [[SOURCE:%.*]] to i8* -; CHECK-NEXT: [[T4:%.*]] = load i8, i8* [[ARRAYIDX223]], align 1 +; CHECK-NEXT: [[ARRAYIDX223:%.*]] = addrspacecast ptr addrspace(1) [[SOURCE:%.*]] to ptr +; CHECK-NEXT: [[T4:%.*]] = load i8, ptr [[ARRAYIDX223]], align 1 ; CHECK-NEXT: ret i8 [[T4]] ; entry: - %arrayidx223 = addrspacecast i8 addrspace(1)* %source to i8* - %t4 = load i8, i8* %arrayidx223 + %arrayidx223 = addrspacecast ptr addrspace(1) %source to ptr + %t4 = load i8, ptr %arrayidx223 ret i8 %t4 } -define <2 x i32> @insertelt(<2 x i32> %x, i32* %p, i133 %index) { +define <2 x i32> @insertelt(<2 x i32> %x, ptr %p, i133 %index) { ; CHECK-LABEL: @insertelt( -; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i32* [[P:%.*]] to i32 +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i32 ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x i32> [[X:%.*]], i32 [[TMP1]], i133 [[INDEX:%.*]] ; CHECK-NEXT: ret <2 x i32> [[R]] ; - %v = inttoptr <2 x i32> %x to <2 x i32*> - %i = insertelement <2 x i32*> %v, i32* %p, i133 %index - %r = ptrtoint <2 x i32*> %i to <2 x i32> + %v = inttoptr <2 x i32> %x to <2 x ptr> + %i = insertelement <2 x ptr> %v, ptr %p, i133 %index + %r = ptrtoint <2 x ptr> %i to <2 x i32> ret <2 x i32> %r } -define <2 x i32> @insertelt_intptr_trunc(<2 x i64> %x, i32* %p) { +define <2 x i32> @insertelt_intptr_trunc(<2 x i64> %x, ptr %p) { ; CHECK-LABEL: @insertelt_intptr_trunc( ; CHECK-NEXT: [[TMP1:%.*]] = trunc <2 x i64> [[X:%.*]] to <2 x i32> -; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint i32* [[P:%.*]] to i32 +; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[P:%.*]] to i32 ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[TMP2]], i64 0 ; CHECK-NEXT: ret <2 x i32> [[R]] ; - %v = inttoptr <2 x i64> %x to <2 x i32*> - %i = insertelement <2 x i32*> %v, i32* %p, i32 0 - %r = ptrtoint <2 x i32*> %i to <2 x i32> + %v = inttoptr <2 x i64> %x to <2 x ptr> + %i = insertelement <2 x ptr> %v, ptr %p, i32 0 + %r = ptrtoint <2 x ptr> %i to <2 x i32> ret <2 x i32> %r } -define <2 x i32> @insertelt_intptr_zext(<2 x i8> %x, i32* %p) { +define <2 x i32> @insertelt_intptr_zext(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @insertelt_intptr_zext( ; CHECK-NEXT: [[TMP1:%.*]] = zext <2 x i8> [[X:%.*]] to <2 x i32> -; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint i32* [[P:%.*]] to i32 +; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[P:%.*]] to i32 ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[TMP2]], i64 1 ; CHECK-NEXT: ret <2 x i32> [[R]] ; - %v = inttoptr <2 x i8> %x to <2 x i32*> - %i = insertelement <2 x i32*> %v, i32* %p, i32 1 - %r = ptrtoint <2 x i32*> %i to <2 x i32> + %v = inttoptr <2 x i8> %x to <2 x ptr> + %i = insertelement <2 x ptr> %v, ptr %p, i32 1 + %r = ptrtoint <2 x ptr> %i to <2 x i32> ret <2 x i32> %r } -define <2 x i64> @insertelt_intptr_zext_zext(<2 x i8> %x, i32* %p) { +define <2 x i64> @insertelt_intptr_zext_zext(<2 x i8> %x, ptr %p) { ; CHECK-LABEL: @insertelt_intptr_zext_zext( ; CHECK-NEXT: [[TMP1:%.*]] = zext <2 x i8> [[X:%.*]] to <2 x i32> -; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint i32* [[P:%.*]] to i32 +; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[P:%.*]] to i32 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[TMP2]], i64 0 ; CHECK-NEXT: [[R:%.*]] = zext <2 x i32> [[TMP3]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[R]] ; - %v = inttoptr <2 x i8> %x to <2 x i32*> - %i = insertelement <2 x i32*> %v, i32* %p, i32 0 - %r = ptrtoint <2 x i32*> %i to <2 x i64> + %v = inttoptr <2 x i8> %x to <2 x ptr> + %i = insertelement <2 x ptr> %v, ptr %p, i32 0 + %r = ptrtoint <2 x ptr> %i to <2 x i64> ret <2 x i64> %r } -declare void @use(<2 x i32*>) +declare void @use(<2 x ptr>) -define <2 x i32> @insertelt_extra_use1(<2 x i32> %x, i32* %p) { +define <2 x i32> @insertelt_extra_use1(<2 x i32> %x, ptr %p) { ; CHECK-LABEL: @insertelt_extra_use1( -; CHECK-NEXT: [[V:%.*]] = inttoptr <2 x i32> [[X:%.*]] to <2 x i32*> -; CHECK-NEXT: call void @use(<2 x i32*> [[V]]) -; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint i32* [[P:%.*]] to i32 +; CHECK-NEXT: [[V:%.*]] = inttoptr <2 x i32> [[X:%.*]] to <2 x ptr> +; CHECK-NEXT: call void @use(<2 x ptr> [[V]]) +; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i32 ; CHECK-NEXT: [[R:%.*]] = insertelement <2 x i32> [[X]], i32 [[TMP1]], i64 0 ; CHECK-NEXT: ret <2 x i32> [[R]] ; - %v = inttoptr <2 x i32> %x to <2 x i32*> - call void @use(<2 x i32*> %v) - %i = insertelement <2 x i32*> %v, i32* %p, i32 0 - %r = ptrtoint <2 x i32*> %i to <2 x i32> + %v = inttoptr <2 x i32> %x to <2 x ptr> + call void @use(<2 x ptr> %v) + %i = insertelement <2 x ptr> %v, ptr %p, i32 0 + %r = ptrtoint <2 x ptr> %i to <2 x i32> ret <2 x i32> %r } -define <2 x i32> @insertelt_extra_use2(<2 x i32> %x, i32* %p) { +define <2 x i32> @insertelt_extra_use2(<2 x i32> %x, ptr %p) { ; CHECK-LABEL: @insertelt_extra_use2( -; CHECK-NEXT: [[V:%.*]] = inttoptr <2 x i32> [[X:%.*]] to <2 x i32*> -; CHECK-NEXT: [[I:%.*]] = insertelement <2 x i32*> [[V]], i32* [[P:%.*]], i64 0 -; CHECK-NEXT: call void @use(<2 x i32*> [[I]]) -; CHECK-NEXT: [[R:%.*]] = ptrtoint <2 x i32*> [[I]] to <2 x i32> +; CHECK-NEXT: [[V:%.*]] = inttoptr <2 x i32> [[X:%.*]] to <2 x ptr> +; CHECK-NEXT: [[I:%.*]] = insertelement <2 x ptr> [[V]], ptr [[P:%.*]], i64 0 +; CHECK-NEXT: call void @use(<2 x ptr> [[I]]) +; CHECK-NEXT: [[R:%.*]] = ptrtoint <2 x ptr> [[I]] to <2 x i32> ; CHECK-NEXT: ret <2 x i32> [[R]] ; - %v = inttoptr <2 x i32> %x to <2 x i32*> - %i = insertelement <2 x i32*> %v, i32* %p, i32 0 - call void @use(<2 x i32*> %i) - %r = ptrtoint <2 x i32*> %i to <2 x i32> + %v = inttoptr <2 x i32> %x to <2 x ptr> + %i = insertelement <2 x ptr> %v, ptr %p, i32 0 + call void @use(<2 x ptr> %i) + %r = ptrtoint <2 x ptr> %i to <2 x i32> ret <2 x i32> %r } diff --git a/llvm/test/Transforms/InstCombine/cmp-intrinsic.ll b/llvm/test/Transforms/InstCombine/cmp-intrinsic.ll index 0eb565ef7932c..e0513ae34330d 100644 --- a/llvm/test/Transforms/InstCombine/cmp-intrinsic.ll +++ b/llvm/test/Transforms/InstCombine/cmp-intrinsic.ll @@ -114,15 +114,15 @@ define <2 x i1> @ctlz_ne_other_v2i32(<2 x i32> %a) { ret <2 x i1> %cmp } -define i1 @ctlz_eq_other_i32_multiuse(i32 %x, i32* %p) { +define i1 @ctlz_eq_other_i32_multiuse(i32 %x, ptr %p) { ; CHECK-LABEL: @ctlz_eq_other_i32_multiuse( ; CHECK-NEXT: [[LZ:%.*]] = tail call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false), [[RNG0:!range !.*]] -; CHECK-NEXT: store i32 [[LZ]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[LZ]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[LZ]], 24 ; CHECK-NEXT: ret i1 [[CMP]] ; %lz = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false) - store i32 %lz, i32* %p + store i32 %lz, ptr %p %cmp = icmp eq i32 %lz, 24 ret i1 %cmp } @@ -167,15 +167,15 @@ define i1 @ctlz_ugt_other_i32(i32 %x) { ret i1 %cmp } -define i1 @ctlz_ugt_other_multiuse_i32(i32 %x, i32* %p) { +define i1 @ctlz_ugt_other_multiuse_i32(i32 %x, ptr %p) { ; CHECK-LABEL: @ctlz_ugt_other_multiuse_i32( ; CHECK-NEXT: [[LZ:%.*]] = tail call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false), [[RNG0]] -; CHECK-NEXT: store i32 [[LZ]], i32* [[P:%.*]], align 4 +; CHECK-NEXT: store i32 [[LZ]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[X]], 32768 ; CHECK-NEXT: ret i1 [[CMP]] ; %lz = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false) - store i32 %lz, i32* %p + store i32 %lz, ptr %p %cmp = icmp ugt i32 %lz, 16 ret i1 %cmp } @@ -210,15 +210,15 @@ define <2 x i1> @ctlz_ult_other_v2i32(<2 x i32> %x) { ret <2 x i1> %cmp } -define <2 x i1> @ctlz_ult_other_multiuse_v2i32(<2 x i32> %x, <2 x i32>* %p) { +define <2 x i1> @ctlz_ult_other_multiuse_v2i32(<2 x i32> %x, ptr %p) { ; CHECK-LABEL: @ctlz_ult_other_multiuse_v2i32( ; CHECK-NEXT: [[LZ:%.*]] = tail call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> [[X:%.*]], i1 false) -; CHECK-NEXT: store <2 x i32> [[LZ]], <2 x i32>* [[P:%.*]], align 8 +; CHECK-NEXT: store <2 x i32> [[LZ]], ptr [[P:%.*]], align 8 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[X]], ; CHECK-NEXT: ret <2 x i1> [[CMP]] ; %lz = tail call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %x, i1 false) - store <2 x i32> %lz, <2 x i32>* %p + store <2 x i32> %lz, ptr %p %cmp = icmp ult <2 x i32> %lz, ret <2 x i1> %cmp } @@ -327,15 +327,15 @@ define <2 x i1> @cttz_ne_other_v2i32(<2 x i32> %a) { ret <2 x i1> %cmp } -define i1 @cttz_eq_other_i33_multiuse(i33 %x, i33* %p) { +define i1 @cttz_eq_other_i33_multiuse(i33 %x, ptr %p) { ; CHECK-LABEL: @cttz_eq_other_i33_multiuse( ; CHECK-NEXT: [[TZ:%.*]] = tail call i33 @llvm.cttz.i33(i33 [[X:%.*]], i1 false), [[RNG1:!range !.*]] -; CHECK-NEXT: store i33 [[TZ]], i33* [[P:%.*]], align 4 +; CHECK-NEXT: store i33 [[TZ]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i33 [[TZ]], 4 ; CHECK-NEXT: ret i1 [[CMP]] ; %tz = tail call i33 @llvm.cttz.i33(i33 %x, i1 false) - store i33 %tz, i33* %p + store i33 %tz, ptr %p %cmp = icmp eq i33 %tz, 4 ret i1 %cmp } @@ -373,15 +373,15 @@ define i1 @cttz_ugt_other_i33(i33 %x) { ret i1 %cmp } -define i1 @cttz_ugt_other_multiuse_i33(i33 %x, i33* %p) { +define i1 @cttz_ugt_other_multiuse_i33(i33 %x, ptr %p) { ; CHECK-LABEL: @cttz_ugt_other_multiuse_i33( ; CHECK-NEXT: [[TZ:%.*]] = tail call i33 @llvm.cttz.i33(i33 [[X:%.*]], i1 false), [[RNG1]] -; CHECK-NEXT: store i33 [[TZ]], i33* [[P:%.*]], align 4 +; CHECK-NEXT: store i33 [[TZ]], ptr [[P:%.*]], align 4 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i33 [[TZ]], 16 ; CHECK-NEXT: ret i1 [[CMP]] ; %tz = tail call i33 @llvm.cttz.i33(i33 %x, i1 false) - store i33 %tz, i33* %p + store i33 %tz, ptr %p %cmp = icmp ugt i33 %tz, 16 ret i1 %cmp } @@ -417,15 +417,15 @@ define <2 x i1> @cttz_ult_other_v2i32(<2 x i32> %x) { ret <2 x i1> %cmp } -define <2 x i1> @cttz_ult_other_multiuse_v2i32(<2 x i32> %x, <2 x i32>* %p) { +define <2 x i1> @cttz_ult_other_multiuse_v2i32(<2 x i32> %x, ptr %p) { ; CHECK-LABEL: @cttz_ult_other_multiuse_v2i32( ; CHECK-NEXT: [[TZ:%.*]] = tail call <2 x i32> @llvm.cttz.v2i32(<2 x i32> [[X:%.*]], i1 false) -; CHECK-NEXT: store <2 x i32> [[TZ]], <2 x i32>* [[P:%.*]], align 8 +; CHECK-NEXT: store <2 x i32> [[TZ]], ptr [[P:%.*]], align 8 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i32> [[TZ]], ; CHECK-NEXT: ret <2 x i1> [[CMP]] ; %tz = tail call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %x, i1 false) - store <2 x i32> %tz, <2 x i32>* %p + store <2 x i32> %tz, ptr %p %cmp = icmp ult <2 x i32> %tz, ret <2 x i1> %cmp } @@ -491,15 +491,15 @@ define <2 x i1> @ctpop_ne_bitwidth_v2i32(<2 x i32> %x) { ret <2 x i1> %cmp } -define i1 @ctpop_ugt_bitwidth_minus_one_i8(i8 %x, i8* %p) { +define i1 @ctpop_ugt_bitwidth_minus_one_i8(i8 %x, ptr %p) { ; CHECK-LABEL: @ctpop_ugt_bitwidth_minus_one_i8( ; CHECK-NEXT: [[POP:%.*]] = tail call i8 @llvm.ctpop.i8(i8 [[X:%.*]]), [[RNG2:!range !.*]] -; CHECK-NEXT: store i8 [[POP]], i8* [[P:%.*]], align 1 +; CHECK-NEXT: store i8 [[POP]], ptr [[P:%.*]], align 1 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[X]], -1 ; CHECK-NEXT: ret i1 [[CMP]] ; %pop = tail call i8 @llvm.ctpop.i8(i8 %x) - store i8 %pop, i8* %p + store i8 %pop, ptr %p %cmp = icmp ugt i8 %pop, 7 ret i1 %cmp } diff --git a/llvm/test/Transforms/InstCombine/compare-signs.ll b/llvm/test/Transforms/InstCombine/compare-signs.ll index 206fe259580e7..2e3a59556be14 100644 --- a/llvm/test/Transforms/InstCombine/compare-signs.ll +++ b/llvm/test/Transforms/InstCombine/compare-signs.ll @@ -219,19 +219,19 @@ define i1 @shift_trunc_signbit_test(i32 %x) { ret i1 %r } -define <2 x i1> @shift_trunc_signbit_test_vec_uses(<2 x i17> %x, <2 x i17>* %p1, <2 x i13>* %p2) { +define <2 x i1> @shift_trunc_signbit_test_vec_uses(<2 x i17> %x, ptr %p1, ptr %p2) { ; CHECK-LABEL: @shift_trunc_signbit_test_vec_uses( ; CHECK-NEXT: [[SH:%.*]] = lshr <2 x i17> [[X:%.*]], -; CHECK-NEXT: store <2 x i17> [[SH]], <2 x i17>* [[P1:%.*]], align 8 +; CHECK-NEXT: store <2 x i17> [[SH]], ptr [[P1:%.*]], align 8 ; CHECK-NEXT: [[TR:%.*]] = trunc <2 x i17> [[SH]] to <2 x i13> -; CHECK-NEXT: store <2 x i13> [[TR]], <2 x i13>* [[P2:%.*]], align 4 +; CHECK-NEXT: store <2 x i13> [[TR]], ptr [[P2:%.*]], align 4 ; CHECK-NEXT: [[R:%.*]] = icmp sgt <2 x i17> [[X]], ; CHECK-NEXT: ret <2 x i1> [[R]] ; %sh = lshr <2 x i17> %x, - store <2 x i17> %sh, <2 x i17>* %p1 + store <2 x i17> %sh, ptr %p1 %tr = trunc <2 x i17> %sh to <2 x i13> - store <2 x i13> %tr, <2 x i13>* %p2 + store <2 x i13> %tr, ptr %p2 %r = icmp sgt <2 x i13> %tr, ret <2 x i1> %r } diff --git a/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll b/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll index 21f358fdbee85..977404c6c5780 100644 --- a/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll +++ b/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll @@ -6,12 +6,12 @@ target triple = "x86_64-unknown-linux-gnu" %test1.struct = type { i32, i32 } @test1.aligned_glbl = global %test1.struct zeroinitializer, align 4 -define void @test1(i64 *%ptr) { +define void @test1(ptr %ptr) { ; CHECK-LABEL: @test1( -; CHECK-NEXT: store i64 0, i64* [[PTR:%.*]], align 8 +; CHECK-NEXT: store i64 0, ptr [[PTR:%.*]], align 8 ; CHECK-NEXT: ret void ; - store i64 and (i64 ptrtoint (i32* getelementptr (%test1.struct, %test1.struct* @test1.aligned_glbl, i32 0, i32 1) to i64), i64 3), i64* %ptr + store i64 and (i64 ptrtoint (ptr getelementptr (%test1.struct, ptr @test1.aligned_glbl, i32 0, i32 1) to i64), i64 3), ptr %ptr ret void } @@ -21,11 +21,11 @@ define void @test1(i64 *%ptr) { define i64 @OpenFilter(i64 %x) { ; CHECK-LABEL: @OpenFilter( -; CHECK-NEXT: [[T:%.*]] = sub i64 [[X:%.*]], zext (i8 ptrtoint ([9 x i8]* @channel_wg4idx to i8) to i64) +; CHECK-NEXT: [[T:%.*]] = sub i64 [[X:%.*]], zext (i8 ptrtoint (ptr @channel_wg4idx to i8) to i64) ; CHECK-NEXT: [[R:%.*]] = and i64 [[T]], 255 ; CHECK-NEXT: ret i64 [[R]] ; - %sub = sub i64 %x, ptrtoint ([9 x i8]* @channel_wg4idx to i64) + %sub = sub i64 %x, ptrtoint (ptr @channel_wg4idx to i64) %t = trunc i64 %sub to i8 %r = zext i8 %t to i64 ret i64 %r diff --git a/llvm/test/Transforms/InstCombine/constant-fold-alias.ll b/llvm/test/Transforms/InstCombine/constant-fold-alias.ll index 9bdbcf9902a6a..0cb1d2eb54c05 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-alias.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-alias.ll @@ -6,28 +6,28 @@ target datalayout = "e-p1:16:16-p2:32:32-p3:64:64" @G2 = global i32 42 @G3 = global [4 x i8] zeroinitializer, align 1 -@A1 = alias i32, bitcast (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 2) to i32*) -@A2 = alias i32, inttoptr (i64 and (i64 ptrtoint (i8* getelementptr inbounds ([4 x i8], [4 x i8]* @G3, i32 0, i32 3) to i64), i64 -4) to i32*) +@A1 = alias i32, getelementptr inbounds ([4 x i8], ptr @G3, i32 0, i32 2) +@A2 = alias i32, inttoptr (i64 and (i64 ptrtoint (ptr getelementptr inbounds ([4 x i8], ptr @G3, i32 0, i32 3) to i64), i64 -4) to ptr) define i64 @f1() { ; This cannot be constant folded because G1 is underaligned. ; CHECK-LABEL: @f1( ; CHECK: ret i64 and - ret i64 and (i64 ptrtoint (i32* @G1 to i64), i64 1) + ret i64 and (i64 ptrtoint (ptr @G1 to i64), i64 1) } define i64 @f2() { ; The preferred alignment for G2 allows this one to foled to zero. ; CHECK-LABEL: @f2( ; CHECK: ret i64 0 - ret i64 and (i64 ptrtoint (i32* @G2 to i64), i64 1) + ret i64 and (i64 ptrtoint (ptr @G2 to i64), i64 1) } define i64 @g1() { ; This cannot be constant folded because A1 aliases G3 which is underalaigned. ; CHECK-LABEL: @g1( ; CHECK: ret i64 and - ret i64 and (i64 ptrtoint (i32* @A1 to i64), i64 1) + ret i64 and (i64 ptrtoint (ptr @A1 to i64), i64 1) } define i64 @g2() { @@ -35,6 +35,6 @@ define i64 @g2() { ; certain alignment allowing this to fold to zero. ; CHECK-LABEL: @g2( ; CHECK: ret i64 0 - ret i64 and (i64 ptrtoint (i32* @A2 to i64), i64 1) + ret i64 and (i64 ptrtoint (ptr @A2 to i64), i64 1) } diff --git a/llvm/test/Transforms/InstCombine/constant-fold-compare.ll b/llvm/test/Transforms/InstCombine/constant-fold-compare.ll index 14564d6d3e193..df6d63493de63 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-compare.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-compare.ll @@ -3,6 +3,6 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 define i32 @a() nounwind readnone { entry: - ret i32 zext (i1 icmp eq (i32 0, i32 ptrtoint (i32 ()* @a to i32)) to i32) + ret i32 zext (i1 icmp eq (i32 0, i32 ptrtoint (ptr @a to i32)) to i32) } ; CHECK: ret i32 0 diff --git a/llvm/test/Transforms/InstCombine/constant-fold-gep.ll b/llvm/test/Transforms/InstCombine/constant-fold-gep.ll index ba38615898ede..375202ec3d0fe 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-gep.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-gep.ll @@ -11,50 +11,50 @@ target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32- define void @frob() { ; CHECK-LABEL: @frob( -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 8 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 4 -; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8 -; CHECK-NEXT: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 16 -; CHECK-NEXT: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8 +; CHECK-NEXT: store i32 1, ptr @Y, align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 2), align 8 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 1, i64 0), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 1, i64 1), align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 1, i64 2), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 0, i64 0), align 8 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 0, i64 2), align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 1, i64 0), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 1, i64 1), align 8 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 1, i32 1, i64 2), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 0, i64 0), align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 0, i64 2), align 8 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 1, i64 0), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 1, i64 1), align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 2, i32 1, i64 2), align 4 +; CHECK-NEXT: store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 1, i64 0, i32 0, i64 0), align 8 +; CHECK-NEXT: store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 2, i64 0, i32 0, i64 0), align 16 +; CHECK-NEXT: store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 1, i64 0, i32 0, i64 1), align 8 ; CHECK-NEXT: ret void ; - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 4 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 36), align 8 - store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 19), align 8 + store i32 1, ptr @Y, align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 1), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 2), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 3), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 4), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 5), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 6), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 7), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 8), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 9), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 10), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 11), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 12), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 13), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 14), align 8 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 15), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 16), align 8 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 17), align 4 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 18), align 8 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 36), align 8 + store i32 1, ptr getelementptr ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 19), align 8 ret void } @@ -68,13 +68,12 @@ define i64 @test2() { ; CHECK-NEXT: ret i64 1000 ; entry: - %A = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 1, i64 0) to i8* - %B = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 0, i64 0) to i8* + %A = bitcast ptr getelementptr inbounds ([1000 x i8], ptr @X, i64 1, i64 0) to ptr - %B2 = ptrtoint i8* %B to i64 + %B2 = ptrtoint ptr @X to i64 %C = sub i64 0, %B2 - %D = getelementptr i8, i8* %A, i64 %C - %E = ptrtoint i8* %D to i64 + %D = getelementptr i8, ptr %A, i64 %C + %E = ptrtoint ptr %D to i64 ret i64 %E } @@ -88,13 +87,12 @@ define i16 @test2_as1() { ; entry: - %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [1000 x i8] addrspace(1)* @X_as1, i64 1, i64 0) to i8 addrspace(1)* - %B = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [1000 x i8] addrspace(1)* @X_as1, i64 0, i64 0) to i8 addrspace(1)* + %A = bitcast ptr addrspace(1) getelementptr inbounds ([1000 x i8], ptr addrspace(1) @X_as1, i64 1, i64 0) to ptr addrspace(1) - %B2 = ptrtoint i8 addrspace(1)* %B to i16 + %B2 = ptrtoint ptr addrspace(1) @X_as1 to i16 %C = sub i16 0, %B2 - %D = getelementptr i8, i8 addrspace(1)* %A, i16 %C - %E = ptrtoint i8 addrspace(1)* %D to i16 + %D = getelementptr i8, ptr addrspace(1) %A, i16 %C + %E = ptrtoint ptr addrspace(1) %D to i16 ret i16 %E } @@ -104,17 +102,17 @@ entry: ; an offset of 8-byte. ; Every element in the @CallerInfos array is 16-byte aligned so ; any access from the following gep is 8-byte aligned. -%struct.CallerInfo = type { i8*, i32 } +%struct.CallerInfo = type { ptr, i32 } @CallerInfos = global [128 x %struct.CallerInfo] zeroinitializer, align 16 define i32 @test_gep_in_struct(i64 %idx) { ; CHECK-LABEL: @test_gep_in_struct( -; CHECK-NEXT: [[NS7:%.*]] = getelementptr inbounds [128 x %struct.CallerInfo], [128 x %struct.CallerInfo]* @CallerInfos, i64 0, i64 [[IDX:%.*]], i32 1 -; CHECK-NEXT: [[RES:%.*]] = load i32, i32* [[NS7]], align 8 +; CHECK-NEXT: [[NS7:%.*]] = getelementptr inbounds [128 x %struct.CallerInfo], ptr @CallerInfos, i64 0, i64 [[IDX:%.*]], i32 1 +; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[NS7]], align 8 ; CHECK-NEXT: ret i32 [[RES]] ; - %NS7 = getelementptr inbounds [128 x %struct.CallerInfo], [128 x %struct.CallerInfo]* @CallerInfos, i64 0, i64 %idx, i32 1 - %res = load i32, i32* %NS7, align 1 + %NS7 = getelementptr inbounds [128 x %struct.CallerInfo], ptr @CallerInfos, i64 0, i64 %idx, i32 1 + %res = load i32, ptr %NS7, align 1 ret i32 %res } @@ -122,81 +120,81 @@ define i32 @test_gep_in_struct(i64 %idx) { @g2 = external global i8 declare i64 @get.i64() -declare void @use.ptr(i8*) +declare void @use.ptr(ptr) -define i8* @gep_sub_self() { +define ptr @gep_sub_self() { ; CHECK-LABEL: @gep_sub_self( -; CHECK-NEXT: ret i8* getelementptr (i8, i8* @g, i64 sub (i64 0, i64 ptrtoint (i8* @g to i64))) +; CHECK-NEXT: ret ptr getelementptr (i8, ptr @g, i64 sub (i64 0, i64 ptrtoint (ptr @g to i64))) ; - %p.int = ptrtoint i8* @g to i64 + %p.int = ptrtoint ptr @g to i64 %p.int.neg = sub i64 0, %p.int - %p1 = getelementptr i8, i8* @g, i64 %p.int.neg - ret i8* %p1 + %p1 = getelementptr i8, ptr @g, i64 %p.int.neg + ret ptr %p1 } -define i8* @gep_sub_self_plus_addr(i64 %addr) { +define ptr @gep_sub_self_plus_addr(i64 %addr) { ; CHECK-LABEL: @gep_sub_self_plus_addr( -; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, i8* getelementptr (i8, i8* @g, i64 sub (i64 0, i64 ptrtoint (i8* @g to i64))), i64 [[ADDR:%.*]] -; CHECK-NEXT: ret i8* [[P2]] +; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr getelementptr (i8, ptr @g, i64 sub (i64 0, i64 ptrtoint (ptr @g to i64))), i64 [[ADDR:%.*]] +; CHECK-NEXT: ret ptr [[P2]] ; - %p.int = ptrtoint i8* @g to i64 + %p.int = ptrtoint ptr @g to i64 %p.int.neg = sub i64 0, %p.int - %p1 = getelementptr i8, i8* @g, i64 %p.int.neg - %p2 = getelementptr i8, i8* %p1, i64 %addr - ret i8* %p2 + %p1 = getelementptr i8, ptr @g, i64 %p.int.neg + %p2 = getelementptr i8, ptr %p1, i64 %addr + ret ptr %p2 } -define i8* @gep_plus_addr_sub_self(i64 %addr) { +define ptr @gep_plus_addr_sub_self(i64 %addr) { ; CHECK-LABEL: @gep_plus_addr_sub_self( -; CHECK-NEXT: [[P1:%.*]] = getelementptr i8, i8* @g, i64 [[ADDR:%.*]] -; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, i8* [[P1]], i64 sub (i64 0, i64 ptrtoint (i8* @g to i64)) -; CHECK-NEXT: ret i8* [[P2]] +; CHECK-NEXT: [[P1:%.*]] = getelementptr i8, ptr @g, i64 [[ADDR:%.*]] +; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr [[P1]], i64 sub (i64 0, i64 ptrtoint (ptr @g to i64)) +; CHECK-NEXT: ret ptr [[P2]] ; - %p.int = ptrtoint i8* @g to i64 + %p.int = ptrtoint ptr @g to i64 %p.int.neg = sub i64 0, %p.int - %p1 = getelementptr i8, i8* @g, i64 %addr - %p2 = getelementptr i8, i8* %p1, i64 %p.int.neg - ret i8* %p2 + %p1 = getelementptr i8, ptr @g, i64 %addr + %p2 = getelementptr i8, ptr %p1, i64 %p.int.neg + ret ptr %p2 } -define i8* @gep_plus_addr_sub_self_in_loop() { +define ptr @gep_plus_addr_sub_self_in_loop() { ; CHECK-LABEL: @gep_plus_addr_sub_self_in_loop( ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[ADDR:%.*]] = call i64 @get.i64() -; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, i8* getelementptr (i8, i8* @g, i64 sub (i64 0, i64 ptrtoint (i8* @g to i64))), i64 [[ADDR]] -; CHECK-NEXT: call void @use.ptr(i8* [[P2]]) +; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr getelementptr (i8, ptr @g, i64 sub (i64 0, i64 ptrtoint (ptr @g to i64))), i64 [[ADDR]] +; CHECK-NEXT: call void @use.ptr(ptr [[P2]]) ; CHECK-NEXT: br label [[LOOP]] ; - %p.int = ptrtoint i8* @g to i64 + %p.int = ptrtoint ptr @g to i64 %p.int.neg = sub i64 0, %p.int br label %loop loop: %addr = call i64 @get.i64() - %p1 = getelementptr i8, i8* @g, i64 %addr - %p2 = getelementptr i8, i8* %p1, i64 %p.int.neg - call void @use.ptr(i8* %p2) + %p1 = getelementptr i8, ptr @g, i64 %addr + %p2 = getelementptr i8, ptr %p1, i64 %p.int.neg + call void @use.ptr(ptr %p2) br label %loop } -define i8* @gep_sub_other() { +define ptr @gep_sub_other() { ; CHECK-LABEL: @gep_sub_other( -; CHECK-NEXT: ret i8* getelementptr (i8, i8* @g, i64 sub (i64 0, i64 ptrtoint (i8* @g2 to i64))) +; CHECK-NEXT: ret ptr getelementptr (i8, ptr @g, i64 sub (i64 0, i64 ptrtoint (ptr @g2 to i64))) ; - %p.int = ptrtoint i8* @g2 to i64 + %p.int = ptrtoint ptr @g2 to i64 %p.int.neg = sub i64 0, %p.int - %p1 = getelementptr i8, i8* @g, i64 %p.int.neg - ret i8* %p1 + %p1 = getelementptr i8, ptr @g, i64 %p.int.neg + ret ptr %p1 } define i64 @gep_sub_other_to_int() { ; CHECK-LABEL: @gep_sub_other_to_int( -; CHECK-NEXT: ret i64 sub (i64 ptrtoint (i8* @g to i64), i64 ptrtoint (i8* @g2 to i64)) +; CHECK-NEXT: ret i64 sub (i64 ptrtoint (ptr @g to i64), i64 ptrtoint (ptr @g2 to i64)) ; - %p.int = ptrtoint i8* @g2 to i64 + %p.int = ptrtoint ptr @g2 to i64 %p.int.neg = sub i64 0, %p.int - %p1 = getelementptr i8, i8* @g, i64 %p.int.neg - %p1.int = ptrtoint i8* %p1 to i64 + %p1 = getelementptr i8, ptr @g, i64 %p.int.neg + %p1.int = ptrtoint ptr %p1 to i64 ret i64 %p1.int } diff --git a/llvm/test/Transforms/InstCombine/constant-fold-iteration.ll b/llvm/test/Transforms/InstCombine/constant-fold-iteration.ll index f256cc300b0b5..a4acab5d767a4 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-iteration.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-iteration.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 define i32 @a() nounwind readnone { entry: - ret i32 zext (i1 icmp eq (i32 0, i32 ptrtoint (i32 ()* @a to i32)) to i32) + ret i32 zext (i1 icmp eq (i32 0, i32 ptrtoint (ptr @a to i32)) to i32) } ; CHECK: INSTCOMBINE ITERATION #1 ; CHECK-NOT: INSTCOMBINE ITERATION #2 diff --git a/llvm/test/Transforms/InstCombine/constant-fold-shifts.ll b/llvm/test/Transforms/InstCombine/constant-fold-shifts.ll index 329d772850a24..bcbfdbb09cbdc 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-shifts.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-shifts.ll @@ -5,32 +5,32 @@ ; OSS-Fuzz #14169 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14169 -define void @ossfuzz_14169_test1(i32* %a0) { +define void @ossfuzz_14169_test1(ptr %a0) { ; CHECK-LABEL: @ossfuzz_14169_test1( ; CHECK-NEXT: bb: ; CHECK-NEXT: ret void ; bb: - %B = ptrtoint i32* @A to i64 + %B = ptrtoint ptr @A to i64 %C = icmp sge i64 %B, 0 %X = select i1 %C, i712 0, i712 1 %B9 = lshr i712 %X, 146783911423364576743092537299333564210980159306769991919205685720763064069663027716481187399048043939495936 - %G5 = getelementptr i64, i64* undef, i712 %B9 - store i64* %G5, i64** undef + %G5 = getelementptr i64, ptr undef, i712 %B9 + store ptr %G5, ptr undef ret void } -define void @ossfuzz_14169_test2(i32* %a0) { +define void @ossfuzz_14169_test2(ptr %a0) { ; CHECK-LABEL: @ossfuzz_14169_test2( ; CHECK-NEXT: bb: ; CHECK-NEXT: ret void ; bb: - %B = ptrtoint i32* @A to i64 + %B = ptrtoint ptr @A to i64 %C = icmp sge i64 %B, 0 %X = select i1 %C, i712 0, i712 1 %B9 = shl i712 %X, 146783911423364576743092537299333564210980159306769991919205685720763064069663027716481187399048043939495936 - %G5 = getelementptr i64, i64* undef, i712 %B9 - store i64* %G5, i64** undef + %G5 = getelementptr i64, ptr undef, i712 %B9 + store ptr %G5, ptr undef ret void } diff --git a/llvm/test/Transforms/InstCombine/convergent.ll b/llvm/test/Transforms/InstCombine/convergent.ll index aa2f4a1b27733..3defcc94c304e 100644 --- a/llvm/test/Transforms/InstCombine/convergent.ll +++ b/llvm/test/Transforms/InstCombine/convergent.ll @@ -26,7 +26,7 @@ define i32 @no_extern() { ret i32 %a } -define i32 @indirect_call(i32 ()* %f) { +define i32 @indirect_call(ptr %f) { ; CHECK: call i32 %f() [[$CONVERGENT_ATTR]] %a = call i32 %f() convergent ret i32 %a diff --git a/llvm/test/Transforms/InstCombine/crash.ll b/llvm/test/Transforms/InstCombine/crash.ll index ce25414ac98c2..5f86069ef7368 100644 --- a/llvm/test/Transforms/InstCombine/crash.ll +++ b/llvm/test/Transforms/InstCombine/crash.ll @@ -33,20 +33,20 @@ entry: ; PR4908 -define void @test2(<1 x i16>* nocapture %b, i32* nocapture %c) nounwind ssp { +define void @test2(ptr nocapture %b, ptr nocapture %c) nounwind ssp { entry: - %arrayidx = getelementptr inbounds <1 x i16>, <1 x i16>* %b, i64 0 ; <<1 x i16>*> - %tmp2 = load <1 x i16>, <1 x i16>* %arrayidx ; <<1 x i16>> [#uses=1] + %arrayidx = getelementptr inbounds <1 x i16>, ptr %b, i64 0 ; + %tmp2 = load <1 x i16>, ptr %arrayidx ; <<1 x i16>> [#uses=1] %tmp6 = bitcast <1 x i16> %tmp2 to i16 ; [#uses=1] %tmp7 = zext i16 %tmp6 to i32 ; [#uses=1] %ins = or i32 0, %tmp7 ; [#uses=1] - %arrayidx20 = getelementptr inbounds i32, i32* %c, i64 0 ; [#uses=1] - store i32 %ins, i32* %arrayidx20 + %arrayidx20 = getelementptr inbounds i32, ptr %c, i64 0 ; [#uses=1] + store i32 %ins, ptr %arrayidx20 ret void } ; PR5262 -@tmp2 = global i64 0 ; [#uses=1] +@tmp2 = global i64 0 ; [#uses=1] declare void @use(i64) nounwind @@ -60,7 +60,7 @@ define void @foo(i1) nounwind align 2 { ;