Skip to content
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

[CGSCCPassManagerTest] Replace no-op bitcast to create constant using the old function #72460

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

JOE1994
Copy link
Member

@JOE1994 JOE1994 commented Nov 16, 2023

With opaque pointers enabled, the existing ptr-to-ptr bitcast is a no-op and no longer creates a constant that references the old function.

Replace the no-op bitcast with code that creates a constant that references the old function. The test now fails if the 1 new line of code added to CallGraphUpdater::replaceFunctionWith() in cb0ecc5 is removed (test passes if kept intact).

… the old function

With opaque pointers enabled, the existing ptr-to-ptr bitcast is a no-op and no
longer creates a constant that references the old function.

Replace the no-op bitcast with code that creates a constant that references the
old function. The test now fails if the 1 new line of code added to
`CallGraphUpdater::replaceFunctionWith()` in
cb0ecc5 is removed (test passes if kept
intact).
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 16, 2023

@llvm/pr-subscribers-llvm-analysis

Author: Youngsuk Kim (JOE1994)

Changes

With opaque pointers enabled, the existing ptr-to-ptr bitcast is a no-op and no longer creates a constant that references the old function.

Replace the no-op bitcast with code that creates a constant that references the old function. The test now fails if the 1 new line of code added to CallGraphUpdater::replaceFunctionWith() in cb0ecc5 is removed (test passes if kept intact).


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

1 Files Affected:

  • (modified) llvm/unittests/Analysis/CGSCCPassManagerTest.cpp (+1-2)
diff --git a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
index 309fe277e03fac7..7c22c7074150da0 100644
--- a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1633,8 +1633,7 @@ TEST_F(CGSCCPassManagerTest, TestUpdateCGAndAnalysisManagerForPasses8) {
 
         // Create an unsused constant that is referencing the old (=replaced)
         // function.
-        ConstantExpr::getBitCast(FnF,
-                                 PointerType::getUnqual(FnF->getContext()));
+        ConstantExpr::getPtrToInt(FnF, Type::getInt64Ty(FnF->getContext()));
 
         // Use the CallGraphUpdater to update the call graph.
         CallGraphUpdater CGU;

@JOE1994 JOE1994 requested a review from nikic November 16, 2023 01:12
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM

llvm/unittests/Analysis/CGSCCPassManagerTest.cpp Outdated Show resolved Hide resolved
Fix typo :)

Co-authored-by: Nikita Popov <github@npopov.com>
@JOE1994 JOE1994 merged commit 23d41ed into llvm:main Nov 16, 2023
2 of 3 checks passed
@JOE1994 JOE1994 deleted the update_llvm_unittest branch November 16, 2023 11:00
sr-tream pushed a commit to sr-tream/llvm-project that referenced this pull request Nov 20, 2023
… the old function (llvm#72460)

With opaque pointers enabled, the existing ptr-to-ptr bitcast is a no-op
and no longer creates a constant that references the old function.

Replace the no-op bitcast with code that creates a constant that
references the old function. The test now fails if the 1 new line of
code added to `CallGraphUpdater::replaceFunctionWith()` in
cb0ecc5 is removed (test passes if kept
intact).

---------

Co-authored-by: Nikita Popov <github@npopov.com>
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
… the old function (llvm#72460)

With opaque pointers enabled, the existing ptr-to-ptr bitcast is a no-op
and no longer creates a constant that references the old function.

Replace the no-op bitcast with code that creates a constant that
references the old function. The test now fails if the 1 new line of
code added to `CallGraphUpdater::replaceFunctionWith()` in
cb0ecc5 is removed (test passes if kept
intact).

---------

Co-authored-by: Nikita Popov <github@npopov.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants