diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-22 00:25:01 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-22 00:25:01 +0000 |
commit | eb7c6865cd8d44a882aa7c3e10e1d976f333344f (patch) | |
tree | bca5f7a0dabf590c9a399338d8b5d50c407b9a0e /lib/Transforms | |
parent | f1fb6c836940d1b92c0e3df27f4c9ca6569ff968 (diff) | |
download | external_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')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 6 |
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); |