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

Youngsuk Kim via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 17:09:36 PST 2023


https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/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).

>From 635d759b710b7f220719addd40dab8f76ecbe9cf Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Wed, 15 Nov 2023 18:13:59 -0600
Subject: [PATCH] [CGSCCPassManagerTest] Replace no-op bitcast to create
 constant using 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
cb0ecc5c33bd56a3eed0fa30ac787accec45d637 is removed (test passes if kept
intact).
---
 llvm/unittests/Analysis/CGSCCPassManagerTest.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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;



More information about the llvm-commits mailing list