summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorJacques Pienaar <jpienaar@google.com>2016-04-05 16:18:13 +0000
committerJacques Pienaar <jpienaar@google.com>2016-04-05 16:18:13 +0000
commit42991b3e5ad397a82e2f0336f608a3f911dfbdc7 (patch)
treefd6ca842d01bee433a80e5d499fc9ad11ca0afc5 /llvm/lib/Target
parented89fae6c547fb5d1568ec66cb446f9ba2792e2a (diff)
downloadbcm5719-llvm-42991b3e5ad397a82e2f0336f608a3f911dfbdc7.tar.gz
bcm5719-llvm-42991b3e5ad397a82e2f0336f608a3f911dfbdc7.zip
[lanai] LanaiSetflagAluCombiner more conservative
Summary: LanaiSetflagAluCombiner could previously combine instructions across basic building blocks even when not legal. Make the LanaiSetflagAluCombiner more conservative to avoid this. Reviewers: eliben Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D18746 llvm-svn: 265411
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Lanai/LanaiSetflagAluCombiner.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Target/Lanai/LanaiSetflagAluCombiner.cpp b/llvm/lib/Target/Lanai/LanaiSetflagAluCombiner.cpp
index 28a13909711..988352b0150 100644
--- a/llvm/lib/Target/Lanai/LanaiSetflagAluCombiner.cpp
+++ b/llvm/lib/Target/Lanai/LanaiSetflagAluCombiner.cpp
@@ -233,20 +233,22 @@ static bool isSuitableSetflag(MbbIterator Instruction, MbbIterator End) {
MbbIterator SCCUserIter = Instruction;
while (SCCUserIter != End) {
++SCCUserIter;
- // Early exit when encountering flag setting instruction.
- if (isFlagSettingInstruction(SCCUserIter->getOpcode()))
- break;
+ // Early exit when encountering flag setting or return instruction.
+ if (isFlagSettingInstruction(SCCUserIter->getOpcode()) ||
+ SCCUserIter->isReturn())
+ // Only return true if flags are set post the flag setting instruction
+ // tested or a return is executed.
+ return true;
int CCIndex = getCCOperandPosition(SCCUserIter->getOpcode());
if (CCIndex != -1) {
LPCC::CondCode CC = static_cast<LPCC::CondCode>(
SCCUserIter->getOperand(CCIndex).getImm());
+ // Return false if the flag is used outside of a EQ, NE, PL and MI.
if (CC != LPCC::ICC_EQ && CC != LPCC::ICC_NE && CC != LPCC::ICC_PL &&
CC != LPCC::ICC_MI)
return false;
}
}
-
- return true;
}
return false;
OpenPOWER on IntegriCloud