[llvm] 23d41ed - [CGSCCPassManagerTest] Replace no-op bitcast to create constant using the old function (#72460)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 03:00:40 PST 2023


Author: Youngsuk Kim
Date: 2023-11-16T06:00:36-05:00
New Revision: 23d41ed5c9b85670a08ca340785853074c289ff6

URL: https://github.com/llvm/llvm-project/commit/23d41ed5c9b85670a08ca340785853074c289ff6
DIFF: https://github.com/llvm/llvm-project/commit/23d41ed5c9b85670a08ca340785853074c289ff6.diff

LOG: [CGSCCPassManagerTest] Replace no-op bitcast to create constant using the old function (#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
cb0ecc5c33bd56a3eed0fa30ac787accec45d637 is removed (test passes if kept
intact).

---------

Co-authored-by: Nikita Popov <github at npopov.com>

Added: 
    

Modified: 
    llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
index 309fe277e03fac7..b33567dd602b0ea 100644
--- a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1631,10 +1631,9 @@ TEST_F(CGSCCPassManagerTest, TestUpdateCGAndAnalysisManagerForPasses8) {
           FnF->getEntryBlock().front().moveBefore(RI);
         ASSERT_NE(FnF, nullptr);
 
-        // Create an unsused constant that is referencing the old (=replaced)
+        // Create an unused 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;


        


More information about the llvm-commits mailing list