summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-29 05:51:50 +0000
committerChris Lattner <sabre@nondot.org>2009-10-29 05:51:50 +0000
commit312748848ff9069641c31e5cdaad1c0167fdcbe3 (patch)
tree2843e7798a355e6109f79941c35d0e39b0935995 /llvm/lib/Transforms
parent1dbdbcc04c1c584112f20f7092e920c3b44eb53c (diff)
downloadbcm5719-llvm-312748848ff9069641c31e5cdaad1c0167fdcbe3.tar.gz
bcm5719-llvm-312748848ff9069641c31e5cdaad1c0167fdcbe3.zip
just for the hell of it, allow globalopt to statically evaluate
static constructors with indirect gotos :) llvm-svn: 85495
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index f11230c494b..49e9683a556 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2341,6 +2341,12 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
dyn_cast<ConstantInt>(getVal(Values, SI->getCondition()));
if (!Val) return false; // Cannot determine.
NewBB = SI->getSuccessor(SI->findCaseValue(Val));
+ } else if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(CurInst)) {
+ Value *Val = getVal(Values, IBI->getAddress())->stripPointerCasts();
+ if (BlockAddress *BA = dyn_cast<BlockAddress>(Val))
+ NewBB = BA->getBasicBlock();
+ else
+ return false; // Cannot determine.
} else if (ReturnInst *RI = dyn_cast<ReturnInst>(CurInst)) {
if (RI->getNumOperands())
RetVal = getVal(Values, RI->getOperand(0));
OpenPOWER on IntegriCloud