diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-10-23 15:46:10 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-10-23 15:46:10 +0000 |
commit | ad12df829ce16ff016a9d9dd16c3ab1c0a3bc513 (patch) | |
tree | 993593b58d8a854feca71d01f0e303ec7aed0213 /llvm/lib | |
parent | 1e212e8abb65d264b62a19f7eaa61bc3f94c978b (diff) | |
download | bcm5719-llvm-ad12df829ce16ff016a9d9dd16c3ab1c0a3bc513.tar.gz bcm5719-llvm-ad12df829ce16ff016a9d9dd16c3ab1c0a3bc513.zip |
[SelectionDAG] use 'match' to simplify code; NFC
Vector types are not possible here because this code only starts
matching from the scalar bool value of a conditional branch, but
this is another step towards completely removing the fake binop
queries for not/neg/fneg.
llvm-svn: 345041
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 71814d79098..87921ccb074 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -88,6 +88,7 @@ #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" +#include "llvm/IR/PatternMatch.h" #include "llvm/IR/Statepoint.h" #include "llvm/IR/Type.h" #include "llvm/IR/User.h" @@ -121,6 +122,7 @@ #include <vector> using namespace llvm; +using namespace PatternMatch; #define DEBUG_TYPE "isel" @@ -1824,7 +1826,6 @@ SelectionDAGBuilder::EmitBranchForMergedCondition(const Value *Cond, SwitchCases.push_back(CB); } -/// FindMergedConditions - If Cond is an expression like void SelectionDAGBuilder::FindMergedConditions(const Value *Cond, MachineBasicBlock *TBB, MachineBasicBlock *FBB, @@ -1836,13 +1837,12 @@ void SelectionDAGBuilder::FindMergedConditions(const Value *Cond, bool InvertCond) { // Skip over not part of the tree and remember to invert op and operands at // next level. - if (BinaryOperator::isNot(Cond) && Cond->hasOneUse()) { - const Value *CondOp = BinaryOperator::getNotArgument(Cond); - if (InBlock(CondOp, CurBB->getBasicBlock())) { - FindMergedConditions(CondOp, TBB, FBB, CurBB, SwitchBB, Opc, TProb, FProb, - !InvertCond); - return; - } + Value *NotCond; + if (match(Cond, m_OneUse(m_Not(m_Value(NotCond)))) && + InBlock(NotCond, CurBB->getBasicBlock())) { + FindMergedConditions(NotCond, TBB, FBB, CurBB, SwitchBB, Opc, TProb, FProb, + !InvertCond); + return; } const Instruction *BOp = dyn_cast<Instruction>(Cond); |