@@ -218,7 +218,7 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
218
218
LLVMContext C;
219
219
SMDiagnostic Err;
220
220
std::unique_ptr<Module> M = parseAssemblyString (R"(
221
- define void @f(i8* noalias %a) {
221
+ define void @f(i8* noalias %a, i1 %c ) {
222
222
entry:
223
223
br label %loop
224
224
@@ -228,6 +228,8 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
228
228
%offset2 = add i64 %offset1, 1
229
229
%a1 = getelementptr i8, i8* %a, i64 %offset1
230
230
%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
231
233
br label %loop
232
234
}
233
235
)" , Err, C);
@@ -236,17 +238,23 @@ TEST_F(AliasAnalysisTest, BatchAAPhiCycles) {
236
238
Instruction *Phi = getInstructionByName (*F, " phi" );
237
239
Instruction *A1 = getInstructionByName (*F, " a1" );
238
240
Instruction *A2 = getInstructionByName (*F, " a2" );
241
+ Instruction *S1 = getInstructionByName (*F, " s1" );
242
+ Instruction *S2 = getInstructionByName (*F, " s2" );
239
243
MemoryLocation PhiLoc (Phi, LocationSize::precise (1 ));
240
244
MemoryLocation A1Loc (A1, LocationSize::precise (1 ));
241
245
MemoryLocation A2Loc (A2, LocationSize::precise (1 ));
246
+ MemoryLocation S1Loc (S1, LocationSize::precise (1 ));
247
+ MemoryLocation S2Loc (S2, LocationSize::precise (1 ));
242
248
243
249
auto &AA = getAAResults (*F);
244
250
EXPECT_EQ (NoAlias, AA.alias (A1Loc, A2Loc));
245
251
EXPECT_EQ (MayAlias, AA.alias (PhiLoc, A1Loc));
252
+ EXPECT_EQ (NoAlias, AA.alias (S1Loc, S2Loc)); // TODO: This is wrong
246
253
247
254
BatchAAResults BatchAA (AA);
248
255
EXPECT_EQ (NoAlias, BatchAA.alias (A1Loc, A2Loc));
249
256
EXPECT_EQ (NoAlias, BatchAA.alias (PhiLoc, A1Loc)); // TODO: This is wrong.
257
+ EXPECT_EQ (NoAlias, BatchAA.alias (S1Loc, S2Loc)); // TODO: This is wrong
250
258
}
251
259
252
260
class AAPassInfraTest : public testing ::Test {
0 commit comments