[PATCH] D70502: Broaden the definition of a "widenable branch"
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 01:49:30 PST 2019
ebrevnov added inline comments.
================
Comment at: llvm/lib/Analysis/GuardUtils.cpp:47
BasicBlock *&IfTrueBB, BasicBlock *&IfFalseBB) {
- using namespace llvm::PatternMatch;
+ // trivial case:
+ if (match(U, m_Br(m_Intrinsic<Intrinsic::experimental_widenable_condition>(),
----------------
Looks not finished...
================
Comment at: llvm/lib/Transforms/Utils/GuardUtils.cpp:73
- Instruction *WCAnd = cast<Instruction>(WidenableBR->getCondition());
- // Condition is only guaranteed to dominate branch
- WCAnd->moveBefore(WidenableBR);
- Value *OldCond = WCAnd->getOperand(0);
- IRBuilder<> B(WCAnd);
- WCAnd->setOperand(0, B.CreateAnd(NewCond, OldCond));
-
+ if (match(WidenableBR->getCondition(),
+ m_Intrinsic<Intrinsic::experimental_widenable_condition>())) {
----------------
Would it be better to use parseWidenableBranch instead of repeating its logic here.
================
Comment at: llvm/lib/Transforms/Utils/GuardUtils.cpp:97
- Instruction *WCAnd = cast<Instruction>(WidenableBR->getCondition());
- // Condition is only guaranteed to dominate branch
- WCAnd->moveBefore(WidenableBR);
- WCAnd->setOperand(0, NewCond);
-
+ if (match(WidenableBR->getCondition(),
+ m_Intrinsic<Intrinsic::experimental_widenable_condition>())) {
----------------
Same as above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70502/new/
https://reviews.llvm.org/D70502
More information about the llvm-commits
mailing list