[PATCH] D59917: [SelectionDAG][FIX] Allow "returned" arguments to be bit-casted
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 13:32:58 PDT 2019
This revision was automatically updated to reflect the committed changes.
jdoerfert marked an inline comment as done.
Closed by commit rL362546: [SelectionDAG][FIX] Allow "returned" arguments to be bit-casted (authored by jdoerfert, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59917?vs=202989&id=203010#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59917/new/
https://reviews.llvm.org/D59917
Files:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/test/CodeGen/X86/arg_returned_bitcast.ll
Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9111,8 +9111,11 @@
// 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
Index: llvm/trunk/test/CodeGen/X86/arg_returned_bitcast.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/arg_returned_bitcast.ll
+++ llvm/trunk/test/CodeGen/X86/arg_returned_bitcast.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s
+
+; Test that the "returned" attribute "works" even if there is a bitcast between
+; the argument and return value.
+
+declare double* @bar(i8* returned)
+
+define double* @foo(i8*) {
+ %r = tail call double* @bar(i8* %0)
+; CHECK: jmp bar
+ ret double* %r
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59917.203010.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/19e798b9/attachment.bin>
More information about the llvm-commits
mailing list