[all-commits] [llvm/llvm-project] aefab6: [InstSimplify] Use weak symbol in test to show mis...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 4 03:27:56 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aefab6f8d5b13c41d000feaa8f0e567d4b6a4681
      https://github.com/llvm/llvm-project/commit/aefab6f8d5b13c41d000feaa8f0e567d4b6a4681
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll

  Log Message:
  -----------
  [InstSimplify] Use weak symbol in test to show miscompile (NFC)

This fold is incorrect, because it assumes that all indices are
non-zero. This happens to be true for the test as written, but
doesn't hold if we use an extern weak global instead, for which
ptrtoint might be zero.

Add separate tests for the simple constant int case.


  Commit: 75db002725156fba9e9c38b7cefe57b7ed713734
      https://github.com/llvm/llvm-project/commit/75db002725156fba9e9c38b7cefe57b7ed713734
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll

  Log Message:
  -----------
  [ConstantFold] Remove another incorrect icmp of GEP fold

This fold is not correct, because indices might evaluate to zero
even if they are not a literal zero integer. Additionally, this
fold would be wrong (in the general case) for non-i8 types as well,
due to index overflow.

Drop this fold and instead let the target-dependent constant
folder compute the actual offset and fold the comparison based
on that.


Compare: https://github.com/llvm/llvm-project/compare/6231ef262415...75db00272515


More information about the All-commits mailing list