[PATCH] D22420: Fix check for prescheduling to copies from virtual registers

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 16 11:54:24 PDT 2016


Elliot Colp <colpell at ca.ibm.com> writes:
> colpell created this revision.
> colpell added a reviewer: bogner.
> colpell added a subscriber: llvm-commits.
> Herald added a subscriber: MatzeB.
>
> Currently, this check on line 2834 is an exact copy of a check on line
> 2810, which SU should have already passed.

That's not entirely true. They both check SU.getNode(), sure, but one
checks if the Opcode is CopyToReg and the other if it's CopyFromReg.
This change definitely changes behaviour and needs to come with a test
if it's correct, which I'm not really convinced it is.

> Given the context and comment above the check ("Avoid prescheduling
> *to* copies" vs. "Avoid prescheduling copies"), it seems like the
> intention was to check PredSU instead.

> https://reviews.llvm.org/D22420
>
> Files:
>   lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
>
> Index: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> +++ lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> @@ -2831,7 +2831,7 @@
>        continue;
>      // Avoid prescheduling to copies from virtual registers, which don't behave
>      // like other nodes from the perspective of scheduling heuristics.
> -    if (SDNode *N = SU.getNode())
> +    if (SDNode *N = PredSU->getNode())
>        if (N->getOpcode() == ISD::CopyFromReg &&
>            TargetRegisterInfo::isVirtualRegister
>              (cast<RegisterSDNode>(N->getOperand(1))->getReg()))
>


More information about the llvm-commits mailing list