[PATCH] D74066: [ValueTracking] usub(a, b) cannot overflow if a >= b.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 02:26:16 PST 2020


fhahn updated this revision to Diff 242840.
fhahn added a comment.

Updated to limit isImpliedByDomCond to usub.with.overflow calls for now.

In D74066#1859995 <https://reviews.llvm.org/D74066#1859995>, @nikic wrote:

> My only concern here is compile-time impact. Keep in mind that this function is not just being called for `usub.with.overflow`, but for every `sub` in the IR, trying to infer the `nuw` flag. As `isImpliedByDomCondition()` only inspects the direct predecessor, that's probably fine though.


Ah right! isImpliedByDomCondition should not be too expensive, but I've limited using it to usub.with.overflow for now.

> Generally we're missing a pass that can propagate conditions and assumes with non-constant operands (CVP mostly covers the constant operand case)...

Agreed!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74066

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/InstCombine/usub-overflow-known-by-implied-cond.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74066.242840.patch
Type: text/x-patch
Size: 6380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/79abc49e/attachment.bin>


More information about the llvm-commits mailing list