This patch adds more test case focusing on data dependency
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Event Timeline
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp | ||
---|---|---|
697 | This should be EXPECT_FALSE! |
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp | ||
---|---|---|
698 | should this be flow dependency? as the dependency is still read after write. |
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp | ||
---|---|---|
679 | This may make it more clear: Instruction *LoadA0 = getInstructionByName(F, "tmp0"); Instruction *LoadA1 = getInstructionByName(F, "tmp1"); Instruction *LoadA2 = getInstructionByName(F, "tmp2"); Instruction *LoadA3 = getInstructionByName(F, "tmp3"); Instruction *LoadB2 = getInstructionByName(F, "tmp4"); Instruction *LoadB3 = getInstructionByName(F, "tmp5"); Instruction *StoreA1 = LoadA0->getPrevNode(); Instruction *StoreA0 = StoreA1->getPrevNode(); Instruction *StoreB0 = LoadA0->getNextNode(); Instruction *StoreB1 = LoadA2->getPrevNode(); Instruction *StoreA2 = StoreB1->getPrevNode(); // Input forward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadA2, *LoadB2, DT, &PDT, &DI)); // Input backward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadA3, *LoadA2, DT, &PDT, &DI)); // Output forward dependency EXPECT_FALSE(isSafeToMoveBefore(*StoreA0, *LoadA0, DT, &PDT, &DI)); // Output backward dependency EXPECT_FALSE(isSafeToMoveBefore(*StoreA1, *StoreA0, DT, &PDT, &DI)); // Flow forward dependency EXPECT_FALSE(isSafeToMoveBefore(*StoreA1, *StoreB0, DT, &PDT, &DI)); // Flow backward dependency EXPECT_FALSE(isSafeToMoveBefore(*LoadA0, *StoreA1, DT, &PDT, &DI)); // Anti forward dependency EXPECT_FALSE(isSafeToMoveBefore(*LoadA1, *StoreB1, DT, &PDT, &DI)); // Anti backward dependency EXPECT_FALSE(isSafeToMoveBefore(*StoreA2, *LoadA1, DT, &PDT, &DI)); // No input backward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadB2, *LoadA3, DT, &PDT, &DI)); // No input forward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadA3, *LoadB3, DT, &PDT, &DI)); // No output forward dependency EXPECT_TRUE(isSafeToMoveBefore(*StoreA2, *LoadA2, DT, &PDT, &DI)); // No output backward dependency EXPECT_TRUE(isSafeToMoveBefore(*StoreB1, *StoreA2, DT, &PDT, &DI)); // No flow forward dependency EXPECT_TRUE(isSafeToMoveBefore(*StoreB0, *StoreA2, DT, &PDT, &DI)); // No flow backward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadA1, *StoreB0, DT, &PDT, &DI)); // No anti backward dependency EXPECT_TRUE(isSafeToMoveBefore(*StoreB0, *LoadA0, DT, &PDT, &DI)); // No anti forward dependency EXPECT_TRUE(isSafeToMoveBefore(*LoadA0, *LoadA1, DT, &PDT, &DI)); |
This may make it more clear: