Changes from Git (git


  1. [InstCombine] add ptr difference tests; NFC (details)
  2. [InstCombine] improve fold of pointer differences (details)
Commit 70207816e35771459d053ab9faf75a50a4cb92fb by spatel
[InstCombine] add ptr difference tests; NFC
The file was modifiedllvm/test/Transforms/InstCombine/sub-gep.ll
Commit 8b300679192b317aa91a28e781fcf60d4416b0d6 by spatel
[InstCombine] improve fold of pointer differences

This was supposed to be an NFC cleanup, but there's
a real logic difference (did not drop 'nsw') visible
in some tests in addition to an efficiency improvement.

This is because in the case where we have 2 GEPs,
the code was *always* swapping the operands and
negating the result. But if we have 2 GEPs, we
should *never* need swapping/negation AFAICT.

This is part of improving flags propagation noticed
with PR47430.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
The file was modifiedllvm/test/Transforms/InstCombine/sub-gep.ll
The file was modifiedllvm/test/Transforms/InstCombine/sub.ll