diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-03-31 14:44:50 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-03-31 14:44:50 +0000 |
commit | 1931b01a6456182fe27b0fc840c689a38279ae59 (patch) | |
tree | 72c6dbdef6a1f9481c9acb464efde72661989f55 /llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp | |
parent | 85fd10bd932f9d109d674f9553aabdc131cf31e5 (diff) | |
download | bcm5719-llvm-1931b01a6456182fe27b0fc840c689a38279ae59.tar.gz bcm5719-llvm-1931b01a6456182fe27b0fc840c689a38279ae59.zip |
[PowerPC] Remove incorrect use of COPY_TO_REGCLASS in fast isel
The fast isel pass currently emits a COPY_TO_REGCLASS node to convert
from a F4RC to a F8RC register class during conversion of a
floating-point number to integer. There is actually no support in the
common code instruction printers to emit COPY_TO_REGCLASS nodes, so the
PowerPC back-end has special code there to simply ignore
COPY_TO_REGCLASS.
This is correct *if and only if* the source and destination registers of
COPY_TO_REGCLASS are the same (except for the different register class).
But nothing guarantees this to be the case, and if the register
allocator does end up allocating source and destination to different
registers after all, the back-end simply generates incorrect code. I've
included a test case that shows such incorrect code generation.
However, it seems that COPY_TO_REGCLASS is actually not intended to be
used at the MI layer at all. It is used during SelectionDAG, but always
lowered to a plain COPY before emitting MI. Other back-end's fast isel
passes never emit COPY_TO_REGCLASS at all. I suspect it is simply wrong
for the PowerPC back-end to emit it here.
This patch changes the PowerPC back-end to directly emit COPY instead of
COPY_TO_REGCLASS and removes the special handling in the instruction
printers.
Differential Revision: http://reviews.llvm.org/D18605
llvm-svn: 265020
Diffstat (limited to 'llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp index 5214303ec82..d9d9b4f180f 100644 --- a/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp +++ b/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp @@ -136,17 +136,6 @@ void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O, return; } - // For fast-isel, a COPY_TO_REGCLASS may survive this long. This is - // used when converting a 32-bit float to a 64-bit float as part of - // conversion to an integer (see PPCFastISel.cpp:SelectFPToI()), - // as otherwise we have problems with incorrect register classes - // in machine instruction verification. For now, just avoid trying - // to print it as such an instruction has no effect (a 32-bit float - // in a register is already in 64-bit form, just with lower - // precision). FIXME: Is there a better solution? - if (MI->getOpcode() == TargetOpcode::COPY_TO_REGCLASS) - return; - if (!printAliasInstr(MI, O)) printInstruction(MI, O); printAnnotation(O, Annot); |