Skip to content

Commit cefd4ad

Browse files
author
git apple-llvm automerger
committed
Merge commit '81036a61222c' from apple/main into swift/next
2 parents 80e8ed7 + 81036a6 commit cefd4ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/unittests/Analysis/AliasAnalysisTest.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
218218
LLVMContext C;
219219
SMDiagnostic Err;
220220
std::unique_ptr<Module> M = parseAssemblyString(R"(
221-
define void @f(i8* noalias %a) {
221+
define void @f(i8* noalias %a, i1 %c) {
222222
entry:
223223
br label %loop
224224
@@ -228,6 +228,8 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
228228
%offset2 = add i64 %offset1, 1
229229
%a1 = getelementptr i8, i8* %a, i64 %offset1
230230
%a2 = getelementptr i8, i8* %a, i64 %offset2
231+
%s1 = select i1 %c, i8* %a1, i8* %phi
232+
%s2 = select i1 %c, i8* %a2, i8* %a1
231233
br label %loop
232234
}
233235
)", Err, C);
@@ -236,17 +238,23 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
236238
Instruction *Phi = getInstructionByName(*F, "phi");
237239
Instruction *A1 = getInstructionByName(*F, "a1");
238240
Instruction *A2 = getInstructionByName(*F, "a2");
241+
Instruction *S1 = getInstructionByName(*F, "s1");
242+
Instruction *S2 = getInstructionByName(*F, "s2");
239243
MemoryLocation PhiLoc(Phi, LocationSize::precise(1));
240244
MemoryLocation A1Loc(A1, LocationSize::precise(1));
241245
MemoryLocation A2Loc(A2, LocationSize::precise(1));
246+
MemoryLocation S1Loc(S1, LocationSize::precise(1));
247+
MemoryLocation S2Loc(S2, LocationSize::precise(1));
242248

243249
auto &AA = getAAResults(*F);
244250
EXPECT_EQ(NoAlias, AA.alias(A1Loc, A2Loc));
245251
EXPECT_EQ(MayAlias, AA.alias(PhiLoc, A1Loc));
252+
EXPECT_EQ(NoAlias, AA.alias(S1Loc, S2Loc)); // TODO: This is wrong
246253

247254
BatchAAResults BatchAA(AA);
248255
EXPECT_EQ(NoAlias, BatchAA.alias(A1Loc, A2Loc));
249256
EXPECT_EQ(NoAlias, BatchAA.alias(PhiLoc, A1Loc)); // TODO: This is wrong.
257+
EXPECT_EQ(NoAlias, BatchAA.alias(S1Loc, S2Loc)); // TODO: This is wrong
250258
}
251259

252260
class AAPassInfraTest : public testing::Test {

0 commit comments

Comments
 (0)