[PATCH] D150517: [WIP][ValueTracking] Make use of CtxI info in programUndefinedIfUndefOrPoison

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 14 00:11:01 PDT 2023


StephenFan created this revision.
StephenFan added reviewers: nikic, goldstein.w.n.
Herald added subscribers: okura, kuter, asbirlea, hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

There is also two test file crashed. The motivation to do this is I
found that the following file was miscompiled:

  define void @zext_sdiv_not_ok3_maybe_poison_denum(i32 noundef %nn, i16 %xx) {
  entry:
    %n = and i32 %nn, 123
    %x = or i16 %xx, 1
    br label %loop
  loop:
    call void @maythrow()
    %zext = zext i16 %x to i32
    %div = sdiv i32 %n, %zext
    call void @use.i32(i32 %div)
    br label %loop
  }

LICM hoisted `sdiv` to entry block incorrectly. Since if %xx is poison,
sdiv is UB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150517

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/Attributor/dereferenceable-1.ll
  llvm/test/Transforms/Attributor/noalias.ll
  llvm/test/Transforms/Attributor/nonnull.ll
  llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
  llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
  llvm/test/Transforms/LICM/speculate-div.ll
  llvm/test/Transforms/PhaseOrdering/AArch64/matrix-extract-insert.ll
  llvm/test/Transforms/VectorCombine/AArch64/load-extract-insert-store-scalarization.ll
  llvm/test/Transforms/VectorCombine/AArch64/load-extractelement-scalarization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150517.521976.patch
Type: text/x-patch
Size: 29528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230514/715676f8/attachment.bin>


More information about the llvm-commits mailing list