diff options
| author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-03-23 17:46:09 +0000 |
|---|---|---|
| committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-03-23 17:46:09 +0000 |
| commit | 570c6440cd96efde5a8325f5fdc9ae8944f29aab (patch) | |
| tree | 121b49d7b88d1623c16ff782e329b1bdeec7ad9a /llvm/lib | |
| parent | e5c0a041ffe9797c1e8393c48aed300972e3d071 (diff) | |
| download | bcm5719-llvm-570c6440cd96efde5a8325f5fdc9ae8944f29aab.tar.gz bcm5719-llvm-570c6440cd96efde5a8325f5fdc9ae8944f29aab.zip | |
[Hexagon] Two fixes in early if-conversion
- Fix checking for vector predicate registers.
- Avoid speculating llvm.lifetime.end intrinsic.
Patch by Harsha Jagasia and Brendon Cahoon.
llvm-svn: 328339
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp index 11a042d5096..8410dc4a5f7 100644 --- a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp +++ b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp @@ -191,6 +191,7 @@ namespace { bool isProfitable(const FlowPattern &FP) const; bool isPredicableStore(const MachineInstr *MI) const; bool isSafeToSpeculate(const MachineInstr *MI) const; + bool isPredicate(unsigned R) const; unsigned getCondStoreOpcode(unsigned Opc, bool IfTrue) const; void predicateInstr(MachineBasicBlock *ToB, MachineBasicBlock::iterator At, @@ -387,13 +388,8 @@ bool HexagonEarlyIfConversion::isValidCandidate(const MachineBasicBlock *B) unsigned R = MO.getReg(); if (!TargetRegisterInfo::isVirtualRegister(R)) continue; - switch (MRI->getRegClass(R)->getID()) { - case Hexagon::PredRegsRegClassID: - case Hexagon::HvxQRRegClassID: - break; - default: - continue; - } + if (!isPredicate(R)) + continue; for (auto U = MRI->use_begin(R); U != MRI->use_end(); ++U) if (U->getParent()->isPHI()) return false; @@ -443,8 +439,7 @@ bool HexagonEarlyIfConversion::isValid(const FlowPattern &FP) const { if (usesUndefVReg(&MI)) return false; unsigned DefR = MI.getOperand(0).getReg(); - const TargetRegisterClass *RC = MRI->getRegClass(DefR); - if (RC == &Hexagon::PredRegsRegClass) + if (isPredicate(DefR)) return false; } } @@ -680,10 +675,18 @@ bool HexagonEarlyIfConversion::isSafeToSpeculate(const MachineInstr *MI) return false; if (MI->hasUnmodeledSideEffects()) return false; + if (MI->getOpcode() == TargetOpcode::LIFETIME_END) + return false; return true; } +bool HexagonEarlyIfConversion::isPredicate(unsigned R) const { + const TargetRegisterClass *RC = MRI->getRegClass(R); + return RC == &Hexagon::PredRegsRegClass || + RC == &Hexagon::HvxQRRegClass; +} + unsigned HexagonEarlyIfConversion::getCondStoreOpcode(unsigned Opc, bool IfTrue) const { return HII->getCondOpcode(Opc, !IfTrue); |

