diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-04-11 23:51:38 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-04-11 23:51:38 +0000 |
commit | bc83d9f70fc57f147103e298e07a9c89464cc137 (patch) | |
tree | eb021ce586cbacded2e9eb4cfcab6f522cf17cf5 /lib/CodeGen/CGCall.cpp | |
parent | dc54701c1f092eb688feee78d50a0bfad557636c (diff) |
Revert r234581, it might have caused a few miscompiles in Chromium.
If the revert helps, I'll get a repro this Monday. Else I'll put the change
back in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index d82c58fb7e..c031bd7940 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -30,7 +30,6 @@ #include "llvm/IR/DataLayout.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/Intrinsics.h" -#include "llvm/IR/IntrinsicInst.h" #include "llvm/Transforms/Utils/Local.h" #include <sstream> using namespace clang; @@ -2217,29 +2216,7 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction &CGF) { if (!CGF.ReturnValue->hasOneUse()) { llvm::BasicBlock *IP = CGF.Builder.GetInsertBlock(); if (IP->empty()) return nullptr; - llvm::Instruction *I = &IP->back(); - - // Skip lifetime markers - for (llvm::BasicBlock::reverse_iterator II = IP->rbegin(), - IE = IP->rend(); - II != IE; ++II) { - if (llvm::IntrinsicInst *Intrinsic = - dyn_cast<llvm::IntrinsicInst>(&*II)) { - if (Intrinsic->getIntrinsicID() == llvm::Intrinsic::lifetime_end) { - const llvm::Value *CastAddr = Intrinsic->getArgOperand(1); - ++II; - if (isa<llvm::BitCastInst>(&*II)) { - if (CastAddr == &*II) { - continue; - } - } - } - } - I = &*II; - break; - } - - llvm::StoreInst *store = dyn_cast<llvm::StoreInst>(I); + llvm::StoreInst *store = dyn_cast<llvm::StoreInst>(&IP->back()); if (!store) return nullptr; if (store->getPointerOperand() != CGF.ReturnValue) return nullptr; assert(!store->isAtomic() && !store->isVolatile()); // see below @@ -2337,8 +2314,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI, // If there is a dominating store to ReturnValue, we can elide // the load, zap the store, and usually zap the alloca. - if (llvm::StoreInst *SI = - findDominatingStoreToReturnValue(*this)) { + if (llvm::StoreInst *SI = findDominatingStoreToReturnValue(*this)) { // Reuse the debug location from the store unless there is // cleanup code to be emitted between the store and return // instruction. |