aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <joseph942010@gmail.com>2023-11-13 13:05:27 -0500
committerGitHub <noreply@github.com>2023-11-13 13:05:27 -0500
commit876236023ce471324c43ca47a811562325197209 (patch)
tree82da1531a28ee93c95f207213a0250bb7f0b5452 /llvm/lib/IR/Module.cpp
parentaf8428c0d9cd8daca8fd7d459a334707b00e2d3d (diff)
downloadllvm-876236023ce471324c43ca47a811562325197209.zip
llvm-876236023ce471324c43ca47a811562325197209.tar.gz
llvm-876236023ce471324c43ca47a811562325197209.tar.bz2
[llvm] Remove no-op ptr-to-ptr bitcasts (NFC) (#72133)
Opaque ptr cleanup effort (NFC).
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp13
1 files changed, 0 insertions, 13 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 17efe79..eeb90a6 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -156,12 +156,6 @@ FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
return {Ty, New}; // Return the new prototype.
}
- // If the function exists but has the wrong type, return a bitcast to the
- // right type.
- auto *PTy = PointerType::get(Ty, F->getAddressSpace());
- if (F->getType() != PTy)
- return {Ty, ConstantExpr::getBitCast(F, PTy)};
-
// Otherwise, we just found the existing function or a prototype.
return {Ty, F};
}
@@ -212,13 +206,6 @@ Constant *Module::getOrInsertGlobal(
GV = CreateGlobalCallback();
assert(GV && "The CreateGlobalCallback is expected to create a global");
- // If the variable exists but has the wrong type, return a bitcast to the
- // right type.
- Type *GVTy = GV->getType();
- PointerType *PTy = PointerType::get(Ty, GVTy->getPointerAddressSpace());
- if (GVTy != PTy)
- return ConstantExpr::getBitCast(GV, PTy);
-
// Otherwise, we just found the existing function or a prototype.
return GV;
}