[PATCH] D134966: [DAG] Update foldSelectWithIdentityConstant to use llvm::isNeutralConstant

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 14:02:59 PDT 2022


craig.topper added a comment.

In D134966#3834797 <https://reviews.llvm.org/D134966#3834797>, @srj wrote:

> Looks like the Halide failure is a SIGFPE on an idiv instruction... we are doing idiv %r15b with edx=0xff, eax=0x8382ff80, r15=0xffffffff... i.e., we are dividing by -1. The result won't fit into 32 bits, so we fail.

I'm guessing we had (sdiv %x, (select %c, %y, 1)) and turned it into (select %c, (sdiv %x, %y), %x). The original code may have been selecting a safe divisor. The new code is not. What happens if we remove SDIV and UREM from isNeutralConstant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134966



More information about the llvm-commits mailing list