summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/GlobalOpt.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-06-22 00:25:01 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-06-22 00:25:01 +0000
commiteb7c6865cd8d44a882aa7c3e10e1d976f333344f (patch)
treebca5f7a0dabf590c9a399338d8b5d50c407b9a0e /lib/Transforms/IPO/GlobalOpt.cpp
parentf1fb6c836940d1b92c0e3df27f4c9ca6569ff968 (diff)
downloadexternal_llvm-eb7c6865cd8d44a882aa7c3e10e1d976f333344f.zip
external_llvm-eb7c6865cd8d44a882aa7c3e10e1d976f333344f.tar.gz
external_llvm-eb7c6865cd8d44a882aa7c3e10e1d976f333344f.tar.bz2
remove extractMallocCallFromBitCast, since it was tailor maded for its sole user. Update GlobalOpt accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index cca959b..ab58c41 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1567,8 +1567,10 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV,
Instruction *Cast = new BitCastInst(Malloc, CI->getType(), "tmp", CI);
CI->replaceAllUsesWith(Cast);
CI->eraseFromParent();
- CI = dyn_cast<BitCastInst>(Malloc) ?
- extractMallocCallFromBitCast(Malloc) : cast<CallInst>(Malloc);
+ if (BitCastInst *BCI = dyn_cast<BitCastInst>(Malloc))
+ CI = cast<CallInst>(BCI->getOperand(0));
+ else
+ CI = cast<CallInst>(Malloc);
}
GVI = PerformHeapAllocSRoA(GV, CI, getMallocArraySize(CI, TD, true), TD);