[PATCH] D65692: [ValueTracking] When calculating known bits for integer abs, make sure we're looking at a negate and not just any instruction with the nsw flag set.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 23:52:57 PDT 2019
nikic added a comment.
As we only have a handful of SPF_ABS uses, it might make sense to introduce a separate abs flavor for the nsw case (which would also allow to handle the x-y case more accurately). SPF_PABS? SPF_ABS_NSW?
(Not in this revision of course.)
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1098
// will be 0 because that makes abs(INT_MIN) undefined.
- if (Q.IIQ.hasNoSignedWrap(cast<Instruction>(RHS)))
+ if (match(RHS, m_NSWSub(m_ZeroInt(), m_Specific(LHS))))
MaxHighZeros = 1;
----------------
I think this should still be going through IIQ, otherwise NewGVN might be unhappy.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65692/new/
https://reviews.llvm.org/D65692
More information about the llvm-commits
mailing list