[all-commits] [llvm/llvm-project] 8b3006: [InstCombine] improve fold of pointer differences

RotateRight via All-commits all-commits at lists.llvm.org
Mon Sep 7 12:55:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b300679192b317aa91a28e781fcf60d4416b0d6
      https://github.com/llvm/llvm-project/commit/8b300679192b317aa91a28e781fcf60d4416b0d6
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-09-07 (Mon, 07 Sep 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/sub-gep.ll
    M llvm/test/Transforms/InstCombine/sub.ll

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list