diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-10-24 19:14:43 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2017-10-24 19:14:43 +0000 |
commit | e45b3d5dad003d71da8df2692bf11c5c1f429434 (patch) | |
tree | a8ec9047111b6a5360817808edb703b8c65c4a78 /clang/lib/CodeGen/CGExpr.cpp | |
parent | b71d1b8a54b0e4c5d636d0986b78028ba606dcb4 (diff) | |
download | bcm5719-llvm-e45b3d5dad003d71da8df2692bf11c5c1f429434.tar.gz bcm5719-llvm-e45b3d5dad003d71da8df2692bf11c5c1f429434.zip |
CodeGen: Fix missing debug loc due to alloca
Builder save/restores insertion pointer when emitting addr space cast
for alloca, but does not save/restore debug loc, which causes verifier
failure for certain call instructions.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D39069
llvm-svn: 316484
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 2eb6d0a0c00..6837377de87 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ Address CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, CharUnits Align, // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); - auto CurIP = Builder.saveIP(); + llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); - Builder.restoreIP(CurIP); } return Address(V, Align); |