[PATCH] D75385: [TargetLowering] Avoid infinite iteration on setcc fold

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 08:05:04 PST 2020


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:2967
     // already a zero (otherwise, infinite loop).
     auto *YConst = dyn_cast<ConstantSDNode>(Y);
     if (YConst && YConst->isNullValue())
----------------
greened wrote:
> RKSimon wrote:
> > Is this happening with vector cases, in which case would this work instead:
> > 
> > ConstantSDNode *YConst = isConstOrConstSplat(Y) ?
> That would work for the case I saw.  But it seems prudent to guard against future constructs which might appear.  Anything that results in `Y` == `Zero` is going to cause an infinite loop.
Under what circumstances will the isConstOrConstSplat + isNullValue() fail but the comparison against Zero work?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75385/new/

https://reviews.llvm.org/D75385





More information about the llvm-commits mailing list