[llvm] 208257f - [CoroElide] Remove unnecessary bitcast (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 06:22:06 PDT 2025


Author: Nikita Popov
Date: 2025-04-23T15:21:52+02:00
New Revision: 208257f7e0f1e7bbf878753bb8a7554891b84380

URL: https://github.com/llvm/llvm-project/commit/208257f7e0f1e7bbf878753bb8a7554891b84380
DIFF: https://github.com/llvm/llvm-project/commit/208257f7e0f1e7bbf878753bb8a7554891b84380.diff

LOG: [CoroElide] Remove unnecessary bitcast (NFCI)

No longer needed with opaque pointers.

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroElide.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroElide.cpp b/llvm/lib/Transforms/Coroutines/CoroElide.cpp
index 5dba7594cb706..c5131aa0787ed 100644
--- a/llvm/lib/Transforms/Coroutines/CoroElide.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroElide.cpp
@@ -81,22 +81,6 @@ class CoroIdElider {
 // provided constant.
 static void replaceWithConstant(Constant *Value,
                                 SmallVectorImpl<CoroSubFnInst *> &Users) {
-  if (Users.empty())
-    return;
-
-  // See if we need to bitcast the constant to match the type of the intrinsic
-  // being replaced. Note: All coro.subfn.addr intrinsics return the same type,
-  // so we only need to examine the type of the first one in the list.
-  Type *IntrTy = Users.front()->getType();
-  Type *ValueTy = Value->getType();
-  if (ValueTy != IntrTy) {
-    // May need to tweak the function type to match the type expected at the
-    // use site.
-    assert(ValueTy->isPointerTy() && IntrTy->isPointerTy());
-    Value = ConstantExpr::getBitCast(Value, IntrTy);
-  }
-
-  // Now the value type matches the type of the intrinsic. Replace them all!
   for (CoroSubFnInst *I : Users)
     replaceAndRecursivelySimplify(I, Value);
 }


        


More information about the llvm-commits mailing list