[PATCH] D93995: [InstSimplify] Fold division by zero to poison

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 3 09:39:12 PST 2021


nikic created this revision.
nikic added reviewers: aqjune, spatel, lebedev.ri.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Div/rem by zero is immediate undefined behavior and anything goes. Currently we fold it to undef, this patch changes it to fold to poison instead, which is slightly stronger.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93995

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll
  llvm/test/Transforms/InstCombine/div.ll
  llvm/test/Transforms/InstCombine/icmp-div-constant.ll
  llvm/test/Transforms/InstCombine/inselt-binop-inseltpoison.ll
  llvm/test/Transforms/InstCombine/inselt-binop.ll
  llvm/test/Transforms/InstCombine/rem.ll
  llvm/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll
  llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll
  llvm/test/Transforms/InstCombine/shift.ll
  llvm/test/Transforms/InstCombine/vector-udiv.ll
  llvm/test/Transforms/InstCombine/vector-urem.ll
  llvm/test/Transforms/InstSimplify/div.ll
  llvm/test/Transforms/InstSimplify/rem.ll
  llvm/test/Transforms/InstSimplify/undef.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93995.314292.patch
Type: text/x-patch
Size: 20788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210103/a34f64b6/attachment.bin>


More information about the llvm-commits mailing list