[llvm] r253461 - [SelectionDAGBuilder] Make sure DemoteReg ends up in right reg-class.

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 06:59:01 PST 2015


Author: jonpa
Date: Wed Nov 18 08:59:00 2015
New Revision: 253461

URL: http://llvm.org/viewvc/llvm-project?rev=253461&view=rev
Log:
[SelectionDAGBuilder] Make sure DemoteReg ends up in right reg-class.

The virtual register containing the address for returned value on
stack should in the DAG be represented with a CopyFromReg node and not
a Register node. Otherwise, InstrEmitter will not make sure that it
ends up in the right register class for the target instruction.

SystemZ needs this, becuause the reg class for address registers is a
subset of the general 64 bit register class.

test/SystemZ/CodeGen/args-07.ll and args-04.ll updated to run with
-verify-machineinstrs.

Reviewed by Hal Finkel.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/test/CodeGen/SystemZ/args-04.ll
    llvm/trunk/test/CodeGen/SystemZ/args-07.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=253461&r1=253460&r2=253461&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Nov 18 08:59:00 2015
@@ -1344,7 +1344,8 @@ void SelectionDAGBuilder::visitRet(const
     ComputeValueVTs(TLI, DL, PointerType::getUnqual(F->getReturnType()),
                     PtrValueVTs);
 
-    SDValue RetPtr = DAG.getRegister(DemoteReg, PtrValueVTs[0]);
+    SDValue RetPtr = DAG.getCopyFromReg(DAG.getEntryNode(), getCurSDLoc(),
+                                        DemoteReg, PtrValueVTs[0]);
     SDValue RetOp = getValue(I.getOperand(0));
 
     SmallVector<EVT, 4> ValueVTs;

Modified: llvm/trunk/test/CodeGen/SystemZ/args-04.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/args-04.ll?rev=253461&r1=253460&r2=253461&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/args-04.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/args-04.ll Wed Nov 18 08:59:00 2015
@@ -1,7 +1,7 @@
 ; Test incoming GPR, FPR and stack arguments when no extension type is given.
 ; This type of argument is used for passing structures, etc.
 ;
-; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs | FileCheck %s
 
 ; Do some arithmetic so that we can see the register being used.
 define i8 @f1(i8 %r2) {

Modified: llvm/trunk/test/CodeGen/SystemZ/args-07.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/args-07.ll?rev=253461&r1=253460&r2=253461&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/args-07.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/args-07.ll Wed Nov 18 08:59:00 2015
@@ -1,6 +1,6 @@
 ; Test multiple return values (LLVM ABI extension)
 ;
-; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+; RUN: llc < %s -mtriple=s390x-linux-gnu -verify-machineinstrs| FileCheck %s
 
 ; Up to four integer return values fit into GPRs.
 define { i64, i64, i64, i64 } @f1() {




More information about the llvm-commits mailing list