Do not try to materialize a constant using prefix instructions if the selection
using non prefix instructions was able to do it using a single non prefix
instruction.
Details
- Reviewers
nemanjai lei - Group Reviewers
Restricted Project - Commits
- rGb8f3c6d0110f: [PowerPC][NFC] Do not enter prefix selection if it cannot do better.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
1174 | Please correct me if I my understand is wrong here. It seems to me InstCntDirect=1 case has been covered in the check below. // If the prefix and non-prefix cases use the same number of instructions // we will prefer the non-prefix case. if (ResultP && (!Result || InstCntDirectP < InstCntDirect)) Then intention of adding an early exit for InstCntDirect == 1 case is to save the trial of calling selectI64ImmDirectPrefix and further checks below. |
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
1172 | nit: Spelling. |
LGTM.
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
1173 | I think you should simplify this comment to something like: // If we have prefixed instructions and there is a chance we can // materialize the constant with fewer prefixed instructions than // non-prefixed, try that. This clearly communicates that there is no point doing any further checks if we can materialize this with just a single non-prefixed instruction (i.e. we won't be able to materialize it with zero instructions). |
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
1174 | Yes that is correct. There is no need to call selectI64ImmDirectPrefix if we already know that it will fail the check InstCntDirectP < InstCntDirect and that the result it produces won't be used. |
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
1174 | Thanks. LGTM. |
nit: Spelling.