summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-05-15 18:08:17 +0000
committerSanjay Patel <spatel@rotateright.com>2017-05-15 18:08:17 +0000
commit941e8dfcbfedcd4e82ff37bfcf9ba2a7cc558cc9 (patch)
tree7ea9e7e9f78234f03f388545f26b9a225acf08cd
parent0a2678e9aaf301815c3a256e14486ce40c09032d (diff)
downloadbcm5719-llvm-941e8dfcbfedcd4e82ff37bfcf9ba2a7cc558cc9.tar.gz
bcm5719-llvm-941e8dfcbfedcd4e82ff37bfcf9ba2a7cc558cc9.zip
[InstCombine] use m_OneUse to reduce code; NFCI
llvm-svn: 303090
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 92acad336dc..65b1148cb03 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2212,9 +2212,9 @@ Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
// Canonicalize fcmp_one -> fcmp_oeq
FCmpInst::Predicate FPred; Value *Y;
- if (match(&BI, m_Br(m_FCmp(FPred, m_Value(X), m_Value(Y)),
- TrueDest, FalseDest)) &&
- BI.getCondition()->hasOneUse())
+ if (match(&BI, m_Br(m_OneUse(m_FCmp(FPred, m_Value(X), m_Value(Y))),
+ TrueDest, FalseDest))) {
+ // TODO: Why are we only transforming these 3 predicates?
if (FPred == FCmpInst::FCMP_ONE || FPred == FCmpInst::FCMP_OLE ||
FPred == FCmpInst::FCMP_OGE) {
FCmpInst *Cond = cast<FCmpInst>(BI.getCondition());
@@ -2225,12 +2225,12 @@ Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
Worklist.Add(Cond);
return &BI;
}
+ }
// Canonicalize icmp_ne -> icmp_eq
ICmpInst::Predicate IPred;
- if (match(&BI, m_Br(m_ICmp(IPred, m_Value(X), m_Value(Y)),
- TrueDest, FalseDest)) &&
- BI.getCondition()->hasOneUse())
+ if (match(&BI, m_Br(m_OneUse(m_ICmp(IPred, m_Value(X), m_Value(Y))),
+ TrueDest, FalseDest))) {
if (IPred == ICmpInst::ICMP_NE || IPred == ICmpInst::ICMP_ULE ||
IPred == ICmpInst::ICMP_SLE || IPred == ICmpInst::ICMP_UGE ||
IPred == ICmpInst::ICMP_SGE) {
@@ -2241,6 +2241,7 @@ Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
Worklist.Add(Cond);
return &BI;
}
+ }
return nullptr;
}
OpenPOWER on IntegriCloud