aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-03-09 10:43:59 +0100
committerNikita Popov <npopov@redhat.com>2022-03-09 10:46:51 +0100
commite3d87fd6e5a829d22c29db32679998bf818f526f (patch)
tree6cf413b0e40e604f39cfa64c431a441000a4ffb8 /llvm/lib/IR/Function.cpp
parentce205cffdfa0f16ce9441ba46fa43e23cecf8be7 (diff)
downloadllvm-e3d87fd6e5a829d22c29db32679998bf818f526f.zip
llvm-e3d87fd6e5a829d22c29db32679998bf818f526f.tar.gz
llvm-e3d87fd6e5a829d22c29db32679998bf818f526f.tar.bz2
[IR][IPSCCP] Treat different function type as address taken (PR54258)
Without opaque pointers, this code currently treats a call through a bitcast as the function being address taken, and IPSCCP relies on this for correctness. Match the same behavior under opaque pointers by checking that the function types are the same. Fixes https://github.com/llvm/llvm-project/issues/54258.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 6ae3d0b..fa0fd5e 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1803,7 +1803,7 @@ bool Function::hasAddressTaken(const User **PutOffender,
*PutOffender = FU;
return true;
}
- if (!Call->isCallee(&U)) {
+ if (!Call->isCallee(&U) || Call->getFunctionType() != getFunctionType()) {
if (IgnoreARCAttachedCall &&
Call->isOperandBundleOfType(LLVMContext::OB_clang_arc_attachedcall,
U.getOperandNo()))