[PATCH] D70502: Broaden the definition of a "widenable branch"

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 09:54:56 PST 2019


reames marked 2 inline comments as done.
reames 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>(),
----------------
ebrevnov wrote:
> Looks not finished...
Why?  It's the trivial case of a widenable branch?

I can simply remove the comment if it's unhelpful?


================
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>())) {
----------------
ebrevnov wrote:
> Would it be better to use parseWidenableBranch instead of repeating its logic here.
Can't.  I wish we could and tried to find a way, but we need to modify the existing instructions to preserve the "one use" requirement on the widenable condition to be able to determine it's a trivially widenable branch.  


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