diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-05-22 14:36:26 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-05-22 14:36:26 +0000 |
| commit | 8a60e5db701ed04926e120142dbb7bdb0528010a (patch) | |
| tree | 5de222c863122e3d87ded29cff42f8178d39c5fe /clang/lib/CodeGen/CGCall.cpp | |
| parent | 488ebfb73224c8dc082aea56562a007b660426e6 (diff) | |
| download | bcm5719-llvm-8a60e5db701ed04926e120142dbb7bdb0528010a.tar.gz bcm5719-llvm-8a60e5db701ed04926e120142dbb7bdb0528010a.zip | |
Call CreateTempMemWithoutCast for ActiveFlag
Introduced CreateMemTempWithoutCast and CreateTemporaryAllocaWithoutCast to emit alloca
without casting to default addr space.
ActiveFlag is a temporary variable emitted for clean up. It is defined as AllocaInst* type and there is
a cast to AlllocaInst in SetActiveFlag. An alloca casted to generic pointer causes assertion in
SetActiveFlag.
Since there is only load/store of ActiveFlag, it is safe to use the original alloca, therefore use
CreateMemTempWithoutCast is called.
Differential Revision: https://reviews.llvm.org/D47099
llvm-svn: 332982
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 537f3a36ca5..d7a643be7be 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3888,9 +3888,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, assert(NumIRArgs == 1); if (!I->isAggregate()) { // Make a temporary alloca to pass the argument. - Address Addr = CreateMemTemp(I->Ty, ArgInfo.getIndirectAlign(), - "indirect-arg-temp", /*Alloca=*/nullptr, - /*Cast=*/false); + Address Addr = CreateMemTempWithoutCast( + I->Ty, ArgInfo.getIndirectAlign(), "indirect-arg-temp"); IRCallArgs[FirstIRArg] = Addr.getPointer(); I->copyInto(*this, Addr); @@ -3935,9 +3934,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, } if (NeedCopy) { // Create an aligned temporary, and copy to it. - Address AI = CreateMemTemp(I->Ty, ArgInfo.getIndirectAlign(), - "byval-temp", /*Alloca=*/nullptr, - /*Cast=*/false); + Address AI = CreateMemTempWithoutCast( + I->Ty, ArgInfo.getIndirectAlign(), "byval-temp"); IRCallArgs[FirstIRArg] = AI.getPointer(); I->copyInto(*this, AI); } else { |

