[llvm] 6ad4ed5 - [VecLib] Fix: Restore DebugFlag state in ReplaceWithVecLibTest (#78989)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 07:57:23 PST 2024


Author: Paschalis Mpeis
Date: 2024-01-23T15:57:19Z
New Revision: 6ad4ed5f1dd0a8160cd3c7b75e63a0e2f6061b5b

URL: https://github.com/llvm/llvm-project/commit/6ad4ed5f1dd0a8160cd3c7b75e63a0e2f6061b5b
DIFF: https://github.com/llvm/llvm-project/commit/6ad4ed5f1dd0a8160cd3c7b75e63a0e2f6061b5b.diff

LOG: [VecLib] Fix: Restore DebugFlag state in ReplaceWithVecLibTest (#78989)

It appears that Google Tests run multiple modules from the same
invocation.
As a result setting `llvm::DebugFlag` in this pass kept it on in
subsequent passes, which is not the expected behavior.

Added: 
    

Modified: 
    llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp b/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp
index a1f0a4a894c8d11..95f17f93bf4c0b8 100644
--- a/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp
+++ b/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp
@@ -72,9 +72,11 @@ class ReplaceWithVecLibTest : public ::testing::Test {
     PB.registerFunctionAnalyses(FAM);
 
     // Enable debugging and capture std error
+    bool DebugFlagPrev = llvm::DebugFlag;
     llvm::DebugFlag = true;
     testing::internal::CaptureStderr();
     FPM.run(*M->getFunction("foo"), FAM);
+    llvm::DebugFlag = DebugFlagPrev;
     return getLastLine(testing::internal::GetCapturedStderr());
   }
 };


        


More information about the llvm-commits mailing list