summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@mips.com>2018-07-02 08:56:57 +0000
committerPetar Jovanovic <petar.jovanovic@mips.com>2018-07-02 08:56:57 +0000
commit3af2c992dc67f67c401bf063a62c36c1331c029f (patch)
tree90ae3f544e0964dd10041d482fd58e29495c557d /llvm/lib
parentcb8a82929c45cfe7e31b815fdbb84cd2f46b9eda (diff)
downloadbcm5719-llvm-3af2c992dc67f67c401bf063a62c36c1331c029f.tar.gz
bcm5719-llvm-3af2c992dc67f67c401bf063a62c36c1331c029f.zip
[Mips][FastISel] Do not duplicate condition while lowering branches
This change fixes the issue that arises when we duplicate condition from the predecessor block. If the condition's arguments are not considered alive across the blocks, fast regalloc gets confused and starts generating reloads from the slots that have never been spilled to. This change also leads to smaller code given that, unlike on architectures with condition codes, on Mips we can branch directly on register value, thus we gain nothing by duplication. Patch by Dragan Mladjenovic. Differential Revision: https://reviews.llvm.org/D48642 llvm-svn: 336084
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsFastISel.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Target/Mips/MipsFastISel.cpp b/llvm/lib/Target/Mips/MipsFastISel.cpp
index 4b460551539..3b0edfe0b63 100644
--- a/llvm/lib/Target/Mips/MipsFastISel.cpp
+++ b/llvm/lib/Target/Mips/MipsFastISel.cpp
@@ -951,12 +951,9 @@ bool MipsFastISel::selectBranch(const Instruction *I) {
//
MachineBasicBlock *TBB = FuncInfo.MBBMap[BI->getSuccessor(0)];
MachineBasicBlock *FBB = FuncInfo.MBBMap[BI->getSuccessor(1)];
- BI->getCondition();
// For now, just try the simplest case where it's fed by a compare.
if (const CmpInst *CI = dyn_cast<CmpInst>(BI->getCondition())) {
- unsigned CondReg = createResultReg(&Mips::GPR32RegClass);
- if (!emitCmp(CondReg, CI))
- return false;
+ unsigned CondReg = getRegForValue(CI);
BuildMI(*BrBB, FuncInfo.InsertPt, DbgLoc, TII.get(Mips::BGTZ))
.addReg(CondReg)
.addMBB(TBB);
OpenPOWER on IntegriCloud