summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2017-11-18 04:28:59 +0000
committerQuentin Colombet <qcolombet@apple.com>2017-11-18 04:28:59 +0000
commitc0d34d38cb9c12c0fca08faf02aa5606ef3ba6f3 (patch)
tree09790ed01809b051251efbfba927380126bb5325 /llvm/lib
parent63816c09573a459d5cbf6dbd2f7c34bd3adcfc3a (diff)
downloadbcm5719-llvm-c0d34d38cb9c12c0fca08faf02aa5606ef3ba6f3.tar.gz
bcm5719-llvm-c0d34d38cb9c12c0fca08faf02aa5606ef3ba6f3.zip
[AArch64] Map G_LOAD on FPR when the definition goes to a copy to FPR
We used to detect loads feeding fp instructions, but we were failing to take into account cases where this happens through copies. For instance, loads can fed copies coming from the ABI lowering of floating point arguments/results. llvm-svn: 318589
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
index 9940a74d7a8..c497669f937 100644
--- a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
@@ -594,15 +594,24 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
// In that case, we want the default mapping to be on FPR
// instead of blind map every scalar to GPR.
for (const MachineInstr &UseMI :
- MRI.use_instructions(MI.getOperand(0).getReg()))
+ MRI.use_instructions(MI.getOperand(0).getReg())) {
// If we have at least one direct use in a FP instruction,
// assume this was a floating point load in the IR.
// If it was not, we would have had a bitcast before
// reaching that instruction.
- if (isPreISelGenericFloatingPointOpcode(UseMI.getOpcode())) {
+ unsigned UseOpc = UseMI.getOpcode();
+ if (isPreISelGenericFloatingPointOpcode(UseOpc) ||
+ // Check if we feed a copy-like instruction with
+ // floating point constraints. In that case, we are still
+ // feeding fp instructions, but indirectly
+ // (e.g., through ABI copies).
+ ((UseOpc == TargetOpcode::COPY || UseMI.isPHI()) &&
+ getRegBank(UseMI.getOperand(0).getReg(), MRI, TRI) ==
+ &AArch64::FPRRegBank)) {
OpRegBankIdx[0] = PMI_FirstFPR;
break;
}
+ }
break;
case TargetOpcode::G_STORE:
// Check if that store is fed by fp instructions.
OpenPOWER on IntegriCloud