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

David Greene via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 06:52:43 PST 2020


greened marked an inline comment as done.
greened 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())
----------------
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.


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