summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2019-11-04 11:41:07 -0500
committerMichael Liao <michael.hliao@gmail.com>2019-11-05 13:05:05 -0500
commit15140e4bacf94fbc509e5a139909aefcd1cc3363 (patch)
tree6d548c46510591f15034544265838b0cd16ddefd /clang/lib/CodeGen/CGCall.cpp
parent82588e05cc32bb30807e480abd4e689b0dee132a (diff)
downloadbcm5719-llvm-15140e4bacf94fbc509e5a139909aefcd1cc3363.tar.gz
bcm5719-llvm-15140e4bacf94fbc509e5a139909aefcd1cc3363.zip
[hip] Enable pointer argument lowering through coercing type.
Reviewers: tra, rjmccall, yaxunl Subscribers: jvesely, nhaehnle, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69826
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 62e8fa03701..e832e4c2833 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1305,6 +1305,15 @@ static void CreateCoercedStore(llvm::Value *Src,
DstTy = Dst.getType()->getElementType();
}
+ llvm::PointerType *SrcPtrTy = llvm::dyn_cast<llvm::PointerType>(SrcTy);
+ llvm::PointerType *DstPtrTy = llvm::dyn_cast<llvm::PointerType>(DstTy);
+ if (SrcPtrTy && DstPtrTy &&
+ SrcPtrTy->getAddressSpace() != DstPtrTy->getAddressSpace()) {
+ Src = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(Src, DstTy);
+ CGF.Builder.CreateStore(Src, Dst, DstIsVolatile);
+ return;
+ }
+
// If the source and destination are integer or pointer types, just do an
// extension or truncation to the desired type.
if ((isa<llvm::IntegerType>(SrcTy) || isa<llvm::PointerType>(SrcTy)) &&
OpenPOWER on IntegriCloud