r309741 - Fix creating bitcasts with wrong address space
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 1 13:36:57 PDT 2017
Author: arsenm
Date: Tue Aug 1 13:36:57 2017
New Revision: 309741
URL: http://llvm.org/viewvc/llvm-project?rev=309741&view=rev
Log:
Fix creating bitcasts with wrong address space
In a future commit AMDGPU will start passing
aggregates directly to more functions, triggering
asserts in test/CodeGenOpenCL/addr-space-struct-arg.cl
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=309741&r1=309740&r2=309741&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Aug 1 13:36:57 2017
@@ -1223,7 +1223,8 @@ static llvm::Value *CreateCoercedLoad(Ad
//
// FIXME: Assert that we aren't truncating non-padding bits when have access
// to that information.
- Src = CGF.Builder.CreateBitCast(Src, llvm::PointerType::getUnqual(Ty));
+ Src = CGF.Builder.CreateBitCast(Src,
+ Ty->getPointerTo(Src.getAddressSpace()));
return CGF.Builder.CreateLoad(Src);
}
@@ -3946,7 +3947,8 @@ RValue CodeGenFunction::EmitCall(const C
Builder.CreateMemCpy(TempAlloca, Src, SrcSize);
Src = TempAlloca;
} else {
- Src = Builder.CreateBitCast(Src, llvm::PointerType::getUnqual(STy));
+ Src = Builder.CreateBitCast(Src,
+ STy->getPointerTo(Src.getAddressSpace()));
}
auto SrcLayout = CGM.getDataLayout().getStructLayout(STy);
More information about the cfe-commits
mailing list