summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2013-06-13 19:51:17 +0000
committerDerek Schuff <dschuff@google.com>2013-06-13 19:51:17 +0000
commitec9dc01b3324195e76f0ccdc1b0268fafc7f63e4 (patch)
treebfbcbbc5a6ccc8c93a12c0a8e9aca82ad93a4f24 /llvm/lib/IR/Constants.cpp
parent405fab906205f0602bec4ead9dfce502516d324c (diff)
downloadbcm5719-llvm-ec9dc01b3324195e76f0ccdc1b0268fafc7f63e4.tar.gz
bcm5719-llvm-ec9dc01b3324195e76f0ccdc1b0268fafc7f63e4.zip
Fix DeleteDeadVarargs not to crash on functions referenced by BlockAddresses
This pass was assuming that if hasAddressTaken() returns false for a function, the function's only uses are call sites. That's not true because there can be references by BlockAddresses too. Fix the pass to handle this case. Fix BlockAddress::replaceUsesOfWithOnConstant() to allow a function's type to be changed by RAUW'ing the function with a bitcast of the recreated function. Patch by Mark Seaborn. llvm-svn: 183933
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index d370d409e00..e04be1f59d5 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1389,7 +1389,7 @@ void BlockAddress::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
BasicBlock *NewBB = getBasicBlock();
if (U == &Op<0>())
- NewF = cast<Function>(To);
+ NewF = cast<Function>(To->stripPointerCasts());
else
NewBB = cast<BasicBlock>(To);
OpenPOWER on IntegriCloud