[PATCH] D80875: [ValueTracking] Branch on poison is UB, branch cond is non-poison.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 30 13:14:48 PDT 2020


fhahn created this revision.
fhahn added reviewers: aqjune, nlopes, efriedma, spatel.
Herald added subscribers: javed.absar, zzheng, hiraditya.
Herald added a project: LLVM.

According to LangRef, branching on a poison condition is UB, hence the
condition should be guaranteed to not be poison.

This allows us to deduce additional nsw/nuw in some cases.

The changes in test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll
are required because `add nuw %i, -1` means %i can only be 0.

The changes in test/Transforms/LoopUnroll/runtime-small-upperbound.ll
are required, because previously we had a max trip count of 4 and 6
respectively (instead of 3 and 5), because SCEV assumed the additions in
the loops could overflow and the initial value could be just below UMAX,
with the first add overflowing. I also tried to update the test to cover
all possible combinations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80875

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Analysis/ScalarEvolution/limit-depth.ll
  llvm/test/Analysis/ScalarEvolution/trip-count12.ll
  llvm/test/Analysis/ScalarEvolution/trip-count9.ll
  llvm/test/Transforms/IndVarSimplify/X86/loop-invariant-conditions.ll
  llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll
  llvm/test/Transforms/LoopUnroll/runtime-small-upperbound.ll
  llvm/test/Transforms/LoopVectorize/X86/small-size.ll
  llvm/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80875.267470.patch
Type: text/x-patch
Size: 12061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200530/860e0f8e/attachment.bin>


More information about the llvm-commits mailing list