diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 01:17:10 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 01:17:10 +0000 |
| commit | a06ac071652ffed4fe6c443fd22e80c944d308bc (patch) | |
| tree | fb68876dc4a642d41b07827c8c082ff2ac658a37 | |
| parent | cfbdee231270ce34e50c6e570e16974824aa8793 (diff) | |
| download | bcm5719-llvm-a06ac071652ffed4fe6c443fd22e80c944d308bc.tar.gz bcm5719-llvm-a06ac071652ffed4fe6c443fd22e80c944d308bc.zip | |
[RegisterBankInfo] Adapt the copy cost logic to give something sane by default.
The generic implementation stated that all copies were free, which is
unlikely. Now, only the copies within the same register bank are free.
We assume they will get coalesced.
llvm-svn: 272085
| -rw-r--r-- | llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h index cc2c80d186c..e9b2a069a53 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h @@ -359,7 +359,11 @@ public: /// \note Since this is a copy, both registers have the same size. virtual unsigned copyCost(const RegisterBank &A, const RegisterBank &B, unsigned Size) const { - return 0; + // Optimistically assume that copies are coalesced. I.e., when + // they are on the same bank, they are free. + // Otherwise assume a non-zero cost of 1. The targets are supposed + // to override that properly anyway if they care. + return &A != &B; } /// Identifier used when the related instruction mapping instance |

