Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions llvm/unittests/Analysis/AliasAnalysisTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,18 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
LLVMContext C;
SMDiagnostic Err;
std::unique_ptr<Module> M = parseAssemblyString(R"(
define void @f(i8* noalias %a, i1 %c) {
define void @f(ptr noalias %a, i1 %c) {
entry:
br label %loop

loop:
%phi = phi i8* [ null, %entry ], [ %a2, %loop ]
%phi = phi ptr [ null, %entry ], [ %a2, %loop ]
%offset1 = phi i64 [ 0, %entry ], [ %offset2, %loop]
%offset2 = add i64 %offset1, 1
%a1 = getelementptr i8, i8* %a, i64 %offset1
%a2 = getelementptr i8, i8* %a, i64 %offset2
%s1 = select i1 %c, i8* %a1, i8* %phi
%s2 = select i1 %c, i8* %a2, i8* %a1
%a1 = getelementptr i8, ptr %a, i64 %offset1
%a2 = getelementptr i8, ptr %a, i64 %offset2
%s1 = select i1 %c, ptr %a1, ptr %phi
%s2 = select i1 %c, ptr %a2, ptr %a1
br label %loop
}
)", Err, C);
Expand Down Expand Up @@ -280,15 +280,15 @@ TEST_F(AliasAnalysisTest, BatchAAPhiAssumption) {
LLVMContext C;
SMDiagnostic Err;
std::unique_ptr<Module> M = parseAssemblyString(R"(
define void @f(i8* %a.base, i8* %b.base, i1 %c) {
define void @f(ptr %a.base, ptr %b.base, i1 %c) {
entry:
br label %loop

loop:
%a = phi i8* [ %a.next, %loop ], [ %a.base, %entry ]
%b = phi i8* [ %b.next, %loop ], [ %b.base, %entry ]
%a.next = getelementptr i8, i8* %a, i64 1
%b.next = getelementptr i8, i8* %b, i64 1
%a = phi ptr [ %a.next, %loop ], [ %a.base, %entry ]
%b = phi ptr [ %b.next, %loop ], [ %b.base, %entry ]
%a.next = getelementptr i8, ptr %a, i64 1
%b.next = getelementptr i8, ptr %b, i64 1
br label %loop
}
)", Err, C);
Expand Down Expand Up @@ -318,16 +318,16 @@ TEST_F(AliasAnalysisTest, PartialAliasOffset) {
LLVMContext C;
SMDiagnostic Err;
std::unique_ptr<Module> M = parseAssemblyString(R"(
define void @foo(float* %arg, i32 %i) {
define void @foo(ptr %arg, i32 %i) {
bb:
%i2 = zext i32 %i to i64
%i3 = getelementptr inbounds float, float* %arg, i64 %i2
%i4 = bitcast float* %i3 to <2 x float>*
%L1 = load <2 x float>, <2 x float>* %i4, align 16
%i3 = getelementptr inbounds float, ptr %arg, i64 %i2
%i4 = bitcast ptr %i3 to ptr
%L1 = load <2 x float>, ptr %i4, align 16
%i7 = add nuw nsw i32 %i, 1
%i8 = zext i32 %i7 to i64
%i9 = getelementptr inbounds float, float* %arg, i64 %i8
%L2 = load float, float* %i9, align 4
%i9 = getelementptr inbounds float, ptr %arg, i64 %i8
%L2 = load float, ptr %i9, align 4
ret void
}
)",
Expand All @@ -353,11 +353,11 @@ TEST_F(AliasAnalysisTest, PartialAliasOffsetSign) {
LLVMContext C;
SMDiagnostic Err;
std::unique_ptr<Module> M = parseAssemblyString(R"(
define void @f(i64* %p) {
%L1 = load i64, i64* %p
%p.i8 = bitcast i64* %p to i8*
%q = getelementptr i8, i8* %p.i8, i32 1
%L2 = load i8, i8* %q
define void @f(ptr %p) {
%L1 = load i64, ptr %p
%p.i8 = bitcast ptr %p to ptr
%q = getelementptr i8, ptr %p.i8, i32 1
%L2 = load i8, ptr %q
ret void
}
)",
Expand Down Expand Up @@ -388,10 +388,10 @@ class AAPassInfraTest : public testing::Test {

public:
AAPassInfraTest()
: M(parseAssemblyString("define i32 @f(i32* %x, i32* %y) {\n"
: M(parseAssemblyString("define i32 @f(ptr %x, ptr %y) {\n"
"entry:\n"
" %lx = load i32, i32* %x\n"
" %ly = load i32, i32* %y\n"
" %lx = load i32, ptr %x\n"
" %ly = load i32, ptr %y\n"
" %sum = add i32 %lx, %ly\n"
" ret i32 %sum\n"
"}\n",
Expand Down
6 changes: 3 additions & 3 deletions llvm/unittests/Analysis/AliasSetTrackerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ TEST(AliasSetTracker, AliasUnknownInst) {

; Function Attrs: nounwind ssp uwtable
define i32 @read_a() #0 {
%1 = load i32, i32* @a, align 4, !tbaa !3
%1 = load i32, ptr @a, align 4, !tbaa !3
ret i32 %1
}

; Function Attrs: nounwind ssp uwtable
define void @write_b() #0 {
store float 1.000000e+01, float* @b, align 4, !tbaa !7
store float 1.000000e+01, ptr @b, align 4, !tbaa !7
ret void
}

Expand Down Expand Up @@ -72,7 +72,7 @@ TEST(AliasSetTracker, AliasUnknownInst) {
AliasSetTracker AST(BAA);
for (auto &BB : *Test)
AST.add(BB);
// There should be 2 disjoint alias sets. 1 from each call.
// There should be 2 disjoint alias sets. 1 from each call.
ASSERT_EQ((int)AST.getAliasSets().size(), 2);

// Directly test aliasesUnknownInst.
Expand Down
90 changes: 45 additions & 45 deletions llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
EnableKnowledgeRetention.setValue(true);
StringRef Head =
"declare void @llvm.assume(i1)\n"
"declare void @func(i32*, i32*, i32*)\n"
"declare void @func1(i32*, i32*, i32*, i32*)\n"
"declare void @func_many(i32*) \"no-jump-tables\" nounwind "
"declare void @func(ptr, ptr, ptr)\n"
"declare void @func1(ptr, ptr, ptr, ptr)\n"
"declare void @func_many(ptr) \"no-jump-tables\" nounwind "
"\"less-precise-fpmad\" willreturn norecurse\n"
"define void @test(i32* %P, i32* %P1, i32* %P2, i32* %P3) {\n";
"define void @test(ptr %P, ptr %P1, ptr %P2, ptr %P3) {\n";
StringRef Tail = "ret void\n"
"}";
std::vector<std::pair<StringRef, llvm::function_ref<void(Instruction *)>>>
Tests;
Tests.push_back(std::make_pair(
"call void @func(i32* nonnull align 4 dereferenceable(16) %P, i32* align "
"8 noalias %P1, i32* align 8 noundef %P2)\n",
"call void @func(ptr nonnull align 4 dereferenceable(16) %P, ptr align "
"8 noalias %P1, ptr align 8 noundef %P2)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -103,11 +103,11 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
Attribute::AttrKind::Alignment, 4));
}));
Tests.push_back(std::make_pair(
"call void @func1(i32* nonnull align 32 dereferenceable(48) %P, i32* "
"call void @func1(ptr nonnull align 32 dereferenceable(48) %P, ptr "
"nonnull "
"align 8 dereferenceable(28) %P, i32* nonnull align 64 "
"align 8 dereferenceable(28) %P, ptr nonnull align 64 "
"dereferenceable(4) "
"%P, i32* nonnull align 16 dereferenceable(12) %P)\n",
"%P, ptr nonnull align 16 dereferenceable(12) %P)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -127,7 +127,7 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
Attribute::AttrKind::Alignment, 64));
}));
Tests.push_back(std::make_pair(
"call void @func_many(i32* align 8 noundef %P1) cold\n", [](Instruction *I) {
"call void @func_many(ptr align 8 noundef %P1) cold\n", [](Instruction *I) {
ShouldPreserveAllAttributes.setValue(true);
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -142,11 +142,11 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
ASSERT_TRUE(hasMatchesExactlyAttributes(Assume, nullptr, ""));
}));
Tests.push_back(std::make_pair(
"call void @func1(i32* readnone align 32 "
"dereferenceable(48) noalias %P, i32* "
"align 8 dereferenceable(28) %P1, i32* align 64 "
"call void @func1(ptr readnone align 32 "
"dereferenceable(48) noalias %P, ptr "
"align 8 dereferenceable(28) %P1, ptr align 64 "
"dereferenceable(4) "
"%P2, i32* nonnull align 16 dereferenceable(12) %P3)\n",
"%P2, ptr nonnull align 16 dereferenceable(12) %P3)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand Down Expand Up @@ -178,11 +178,11 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
}));

Tests.push_back(std::make_pair(
"call void @func1(i32* readnone align 32 "
"dereferenceable(48) noalias %P, i32* "
"align 8 dereferenceable(28) %P1, i32* align 64 "
"call void @func1(ptr readnone align 32 "
"dereferenceable(48) noalias %P, ptr "
"align 8 dereferenceable(28) %P1, ptr align 64 "
"dereferenceable(4) "
"%P2, i32* nonnull align 16 dereferenceable(12) %P3)\n",
"%P2, ptr nonnull align 16 dereferenceable(12) %P3)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -204,8 +204,8 @@ TEST(AssumeQueryAPI, hasAttributeInAssume) {
Attribute::AttrKind::Dereferenceable, 48));
}));
Tests.push_back(std::make_pair(
"call void @func(i32* nonnull align 4 dereferenceable(16) %P, i32* align "
"8 noalias %P1, i32* %P1)\n",
"call void @func(ptr nonnull align 4 dereferenceable(16) %P, ptr align "
"8 noalias %P1, ptr %P1)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand Down Expand Up @@ -251,18 +251,18 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {
EnableKnowledgeRetention.setValue(true);
StringRef Head =
"declare void @llvm.assume(i1)\n"
"declare void @func(i32*, i32*, i32*)\n"
"declare void @func1(i32*, i32*, i32*, i32*)\n"
"declare void @func_many(i32*) \"no-jump-tables\" nounwind "
"declare void @func(ptr, ptr, ptr)\n"
"declare void @func1(ptr, ptr, ptr, ptr)\n"
"declare void @func_many(ptr) \"no-jump-tables\" nounwind "
"\"less-precise-fpmad\" willreturn norecurse\n"
"define void @test(i32* %P, i32* %P1, i32* %P2, i32* %P3) {\n";
"define void @test(ptr %P, ptr %P1, ptr %P2, ptr %P3) {\n";
StringRef Tail = "ret void\n"
"}";
std::vector<std::pair<StringRef, llvm::function_ref<void(Instruction *)>>>
Tests;
Tests.push_back(std::make_pair(
"call void @func(i32* nonnull align 4 dereferenceable(16) %P, i32* align "
"8 noalias %P1, i32* align 8 dereferenceable(8) %P2)\n",
"call void @func(ptr nonnull align 4 dereferenceable(16) %P, ptr align "
"8 noalias %P1, ptr align 8 dereferenceable(8) %P2)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -283,11 +283,11 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {
{4, 4}));
}));
Tests.push_back(std::make_pair(
"call void @func1(i32* nonnull align 32 dereferenceable(48) %P, i32* "
"call void @func1(ptr nonnull align 32 dereferenceable(48) %P, ptr "
"nonnull "
"align 8 dereferenceable(28) %P, i32* nonnull align 64 "
"align 8 dereferenceable(28) %P, ptr nonnull align 64 "
"dereferenceable(4) "
"%P, i32* nonnull align 16 dereferenceable(12) %P)\n",
"%P, ptr nonnull align 16 dereferenceable(12) %P)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -310,7 +310,7 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {
Map, Assume, {I->getOperand(0), Attribute::Alignment}, {64, 64}));
}));
Tests.push_back(std::make_pair(
"call void @func_many(i32* align 8 %P1) cold\n", [](Instruction *I) {
"call void @func_many(ptr align 8 %P1) cold\n", [](Instruction *I) {
ShouldPreserveAllAttributes.setValue(true);
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand All @@ -331,11 +331,11 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {
ASSERT_TRUE(Map.empty());
}));
Tests.push_back(std::make_pair(
"call void @func1(i32* readnone align 32 "
"dereferenceable(48) noalias %P, i32* "
"align 8 dereferenceable(28) %P1, i32* align 64 "
"call void @func1(ptr readnone align 32 "
"dereferenceable(48) noalias %P, ptr "
"align 8 dereferenceable(28) %P1, ptr align 64 "
"dereferenceable(4) "
"%P2, i32* nonnull align 16 dereferenceable(12) %P3)\n",
"%P2, ptr nonnull align 16 dereferenceable(12) %P3)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand Down Expand Up @@ -371,8 +371,8 @@ TEST(AssumeQueryAPI, fillMapFromAssume) {

/// Keep this test last as it modifies the function.
Tests.push_back(std::make_pair(
"call void @func(i32* nonnull align 4 dereferenceable(16) %P, i32* align "
"8 noalias %P1, i32* %P2)\n",
"call void @func(ptr nonnull align 4 dereferenceable(16) %P, ptr align "
"8 noalias %P1, ptr %P2)\n",
[](Instruction *I) {
auto *Assume = buildAssumeFromInst(I);
Assume->insertBefore(I->getIterator());
Expand Down Expand Up @@ -507,11 +507,11 @@ TEST(AssumeQueryAPI, AssumptionCache) {
SMDiagnostic Err;
std::unique_ptr<Module> Mod = parseAssemblyString(
"declare void @llvm.assume(i1)\n"
"define void @test(i32* %P, i32* %P1, i32* %P2, i32* %P3, i1 %B) {\n"
"call void @llvm.assume(i1 true) [\"nonnull\"(i32* %P), \"align\"(i32* "
"%P2, i32 4), \"align\"(i32* %P, i32 8)]\n"
"call void @llvm.assume(i1 %B) [\"test\"(i32* %P1), "
"\"dereferenceable\"(i32* %P, i32 4)]\n"
"define void @test(ptr %P, ptr %P1, ptr %P2, ptr %P3, i1 %B) {\n"
"call void @llvm.assume(i1 true) [\"nonnull\"(ptr %P), \"align\"(ptr "
"%P2, i32 4), \"align\"(ptr %P, i32 8)]\n"
"call void @llvm.assume(i1 %B) [\"test\"(ptr %P1), "
"\"dereferenceable\"(ptr %P, i32 4)]\n"
"ret void\n}\n",
Err, C);
if (!Mod)
Expand Down Expand Up @@ -569,11 +569,11 @@ TEST(AssumeQueryAPI, Alignment) {
SMDiagnostic Err;
std::unique_ptr<Module> Mod = parseAssemblyString(
"declare void @llvm.assume(i1)\n"
"define void @test(i32* %P, i32* %P1, i32* %P2, i32 %I3, i1 %B) {\n"
"call void @llvm.assume(i1 true) [\"align\"(i32* %P, i32 8, i32 %I3)]\n"
"call void @llvm.assume(i1 true) [\"align\"(i32* %P1, i32 %I3, i32 "
"define void @test(ptr %P, ptr %P1, ptr %P2, i32 %I3, i1 %B) {\n"
"call void @llvm.assume(i1 true) [\"align\"(ptr %P, i32 8, i32 %I3)]\n"
"call void @llvm.assume(i1 true) [\"align\"(ptr %P1, i32 %I3, i32 "
"%I3)]\n"
"call void @llvm.assume(i1 true) [\"align\"(i32* %P2, i32 16, i32 8)]\n"
"call void @llvm.assume(i1 true) [\"align\"(ptr %P2, i32 16, i32 8)]\n"
"ret void\n}\n",
Err, C);
if (!Mod)
Expand Down
16 changes: 8 additions & 8 deletions llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,26 +1936,26 @@ TEST_F(CGSCCPassManagerTest, TestDeletionOfFunctionInNonTrivialRefSCC) {
TEST_F(CGSCCPassManagerTest, TestInsertionOfNewNonTrivialCallEdge) {
std::unique_ptr<Module> M = parseIR("define void @f1() {\n"
"entry:\n"
" %a = bitcast void ()* @f4 to i8*\n"
" %b = bitcast void ()* @f2 to i8*\n"
" %a = bitcast ptr @f4 to ptr\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit weird now that the bitcasts are explicitly redundant, but I guess it doesn't matter since the test really has nothing to do with bitcasts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a big change from going from instruction to constant

" %b = bitcast ptr @f2 to ptr\n"
" ret void\n"
"}\n"
"define void @f2() {\n"
"entry:\n"
" %a = bitcast void ()* @f1 to i8*\n"
" %b = bitcast void ()* @f3 to i8*\n"
" %a = bitcast ptr @f1 to ptr\n"
" %b = bitcast ptr @f3 to ptr\n"
" ret void\n"
"}\n"
"define void @f3() {\n"
"entry:\n"
" %a = bitcast void ()* @f2 to i8*\n"
" %b = bitcast void ()* @f4 to i8*\n"
" %a = bitcast ptr @f2 to ptr\n"
" %b = bitcast ptr @f4 to ptr\n"
" ret void\n"
"}\n"
"define void @f4() {\n"
"entry:\n"
" %a = bitcast void ()* @f3 to i8*\n"
" %b = bitcast void ()* @f1 to i8*\n"
" %a = bitcast ptr @f3 to ptr\n"
" %b = bitcast ptr @f1 to ptr\n"
" ret void\n"
"}\n");

Expand Down
Loading
Loading