[llvm] 1df8de2 - [VPlan] Add test with intrinsic without side-effects (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 11:31:07 PST 2023


Author: Florian Hahn
Date: 2023-03-03T20:30:30+01:00
New Revision: 1df8de238b5af1caca0c6da8a106c9453d84be6a

URL: https://github.com/llvm/llvm-project/commit/1df8de238b5af1caca0c6da8a106c9453d84be6a
DIFF: https://github.com/llvm/llvm-project/commit/1df8de238b5af1caca0c6da8a106c9453d84be6a.diff

LOG: [VPlan] Add test with intrinsic without side-effects (NFC).

Extra test coverage for mayHaveSideEffects for VPWidenCallRecipe.

Added: 
    

Modified: 
    llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index ff7ee53bfbcf..4328fe9ce85e 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1139,6 +1139,27 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
     delete Call;
   }
 
+  {
+    // Test for a call to a function without side-effects.
+    LLVMContext C;
+    Module M("", C);
+    Function *TheFn = Intrinsic::getDeclaration(&M, Intrinsic::thread_pointer);
+
+    auto *Call = CallInst::Create(TheFn->getFunctionType(), TheFn);
+    VPValue Op1;
+    VPValue Op2;
+    SmallVector<VPValue *, 2> Args;
+    Args.push_back(&Op1);
+    Args.push_back(&Op2);
+    VPWidenCallRecipe Recipe(*Call, make_range(Args.begin(), Args.end()),
+                             false);
+    EXPECT_TRUE(Recipe.mayHaveSideEffects());
+    EXPECT_FALSE(Recipe.mayReadFromMemory());
+    EXPECT_FALSE(Recipe.mayWriteToMemory());
+    EXPECT_FALSE(Recipe.mayReadOrWriteMemory());
+    delete Call;
+  }
+
   {
     VPValue Op1;
     VPValue Op2;


        


More information about the llvm-commits mailing list