Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

paschalis-mpeis
Copy link
Member

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.

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.
@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Jan 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 22, 2024

@llvm/pr-subscribers-llvm-analysis

Author: Paschalis Mpeis (paschalis-mpeis)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/78989.diff

1 Files Affected:

  • (modified) llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp (+2)
diff --git a/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp b/llvm/unittests/Analysis/ReplaceWithVecLibTest.cpp
index a1f0a4a894c8d1..95f17f93bf4c0b 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());
   }
 };

@paschalis-mpeis paschalis-mpeis changed the title [VecLib] Fix: Restore llvm::DebugFlag state after test. [VecLib] Fix: Restore DebugFlag state in ReplaceWithVecLibTest Jan 22, 2024
Copy link
Contributor

@mgabka mgabka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, not sure if any extra changes added to the tests because of this bug needs to be reverted or not, but the change added in this PR looks correct to me.

Copy link
Collaborator

@huntergr-arm huntergr-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paschalis-mpeis paschalis-mpeis merged commit 6ad4ed5 into main Jan 23, 2024
@paschalis-mpeis paschalis-mpeis deleted the users/paschalis-mpeis/fix-replace-veclib-test-llvm-debug-flag branch January 23, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants