aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <jdoerfert@anl.gov>2019-06-04 20:34:43 +0000
committerJohannes Doerfert <jdoerfert@anl.gov>2019-06-04 20:34:43 +0000
commit6b432dca5d4aa6bea8a39e7858f8cfd19f2b87ed (patch)
treed0438462d908535c0dc778db5d36fbf8f7d9d52b /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parent40107ce753ff172f76ceb67da2817868f952c003 (diff)
downloadllvm-6b432dca5d4aa6bea8a39e7858f8cfd19f2b87ed.zip
llvm-6b432dca5d4aa6bea8a39e7858f8cfd19f2b87ed.tar.gz
llvm-6b432dca5d4aa6bea8a39e7858f8cfd19f2b87ed.tar.bz2
[SelectionDAG][FIX] Allow "returned" arguments to be bit-casted
Summary: An argument that is return by a function but bit-casted before can still be annotated as "returned". Make sure we do not crash for this case. Reviewers: sunfish, stephenwlin, niravd, arsenm Subscribers: wdng, hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59917 llvm-svn: 362546
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index da06ac7..4f7257d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9111,8 +9111,11 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
// for now.
if (Args[i].IsReturned && !Op.getValueType().isVector() &&
CanLowerReturn) {
- assert(CLI.RetTy == Args[i].Ty && RetTys.size() == NumValues &&
- "unexpected use of 'returned'");
+ assert((CLI.RetTy == Args[i].Ty ||
+ (CLI.RetTy->isPointerTy() && Args[i].Ty->isPointerTy() &&
+ CLI.RetTy->getPointerAddressSpace() ==
+ Args[i].Ty->getPointerAddressSpace())) &&
+ RetTys.size() == NumValues && "unexpected use of 'returned'");
// Before passing 'returned' to the target lowering code, ensure that
// either the register MVT and the actual EVT are the same size or that
// the return value and argument are extended in the same way; in these