@@ -394,12 +394,16 @@ define void @foo(ptr noalias %ptr, float %val) {
394394
395395TEST_F (SeedBundleTest, VectorStores) {
396396 parseIR (C, R"IR(
397- define void @foo(ptr noalias %ptr, <2 x float> %val ) {
397+ define void @foo(ptr noalias %ptr, <2 x float> %val0, i64 %val1 ) {
398398bb:
399399 %ptr0 = getelementptr float, ptr %ptr, i32 0
400400 %ptr1 = getelementptr float, ptr %ptr, i32 1
401- store <2 x float> %val, ptr %ptr1
402- store <2 x float> %val, ptr %ptr0
401+ %ptr2 = getelementptr i64, ptr %ptr, i32 2
402+ store <2 x float> %val0, ptr %ptr1
403+ store <2 x float> %val0, ptr %ptr0
404+ store atomic i64 %val1, ptr %ptr2 unordered, align 8
405+ store volatile i64 %val1, ptr %ptr2
406+
403407 ret void
404408}
405409)IR" );
@@ -418,14 +422,16 @@ define void @foo(ptr noalias %ptr, <2 x float> %val) {
418422 sandboxir::SeedCollector SC (&*BB, SE);
419423
420424 // Find the stores
421- auto It = std::next (BB->begin (), 2 );
425+ auto It = std::next (BB->begin (), 3 );
422426 // StX with X as the order by offset in memory
423427 auto *St1 = &*It++;
424428 auto *St0 = &*It++;
425429
426430 auto StoreSeedsRange = SC.getStoreSeeds ();
427431 EXPECT_EQ (range_size (StoreSeedsRange), 1u );
428432 auto &SB = *StoreSeedsRange.begin ();
433+ // isValidMemSeed check: The atomic and volatile stores should not
434+ // be included in the bundle, but the vector stores should be.
429435 ExpectThatElementsAre (SB, {St0, St1});
430436}
431437
@@ -466,5 +472,48 @@ define void @foo(ptr noalias %ptr, float %v, <2 x float> %val) {
466472 auto StoreSeedsRange = SC.getStoreSeeds ();
467473 EXPECT_EQ (range_size (StoreSeedsRange), 1u );
468474 auto &SB = *StoreSeedsRange.begin ();
475+ // isValidMemSeedCheck here: all of the three stores should be included.
469476 ExpectThatElementsAre (SB, {St0, St1, St3});
470477}
478+
479+ TEST_F (SeedBundleTest, VectorLoads) {
480+ parseIR (C, R"IR(
481+ define void @foo(ptr noalias %ptr, <2 x float> %val0) {
482+ bb:
483+ %ptr0 = getelementptr float, ptr %ptr, i32 0
484+ %ptr1 = getelementptr float, ptr %ptr, i32 1
485+ %r0 = load <2 x float>, ptr %ptr0
486+ %r1 = load <2 x float>, ptr %ptr1
487+ %r2 = load atomic i64, ptr %ptr0 unordered, align 8
488+ %r3 = load volatile i64, ptr %ptr1
489+
490+ ret void
491+ }
492+ )IR" );
493+ Function &LLVMF = *M->getFunction (" foo" );
494+ DominatorTree DT (LLVMF);
495+ TargetLibraryInfoImpl TLII;
496+ TargetLibraryInfo TLI (TLII);
497+ DataLayout DL (M->getDataLayout ());
498+ LoopInfo LI (DT);
499+ AssumptionCache AC (LLVMF);
500+ ScalarEvolution SE (LLVMF, TLI, AC, DT, LI);
501+
502+ sandboxir::Context Ctx (C);
503+ auto &F = *Ctx.createFunction (&LLVMF);
504+ auto BB = F.begin ();
505+ sandboxir::SeedCollector SC (&*BB, SE);
506+
507+ // Find the stores
508+ auto It = std::next (BB->begin (), 2 );
509+ // StX with X as the order by offset in memory
510+ auto *Ld0 = &*It++;
511+ auto *Ld1 = &*It++;
512+
513+ auto LoadSeedsRange = SC.getLoadSeeds ();
514+ EXPECT_EQ (range_size (LoadSeedsRange), 1u );
515+ auto &SB = *LoadSeedsRange.begin ();
516+ // isValidMemSeed check: The atomic and volatile stores should not
517+ // be included in the bundle, but the vector stores should be.
518+ ExpectThatElementsAre (SB, {Ld0, Ld1});
519+ }
0 commit comments