llvm-project/llvm/test/Analysis/ValueTracking
Piotr Padlewski c63b492bcd Simplify recursive launder.invariant.group and strip
Summary:
This patch is crucial for proving equality laundered/stripped
pointers. eg:

  bool foo(A *a) {
    return a == std::launder(a);
  }

Clang with -fstrict-vtable-pointers will emit something like:

    define dso_local zeroext i1 @_Z3fooP1A(%struct.A* %a) {
    entry:
      %c = bitcast %struct.A* %a to i8*
      %call = tail call i8* @llvm.launder.invariant.group.p0i8(i8* %c)
      %0 = bitcast %struct.A* %a to i8*
      %1 = tail call i8* @llvm.strip.invariant.group.p0i8(i8* %0)
      %2 = tail call i8* @llvm.strip.invariant.group.p0i8(i8* %call)
      %cmp = icmp eq i8* %1, %2
      ret i1 %cmp
    }

and because %2 can be replaced with @llvm.strip.invariant.group(%0)
and that %2 and %1 will produce the same value (because strip is readnone)
we can replace compare with true.

Reviewers: rsmith, hfinkel, majnemer, amharc, kuhar

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D47423

llvm-svn: 336963
2018-07-12 23:55:20 +00:00
..
assume.ll [ValueTracking] Don't delete assumes of side-effectful instructions 2017-08-14 17:11:43 +00:00
deref-bitcast-of-gep.ll Propagate nonnull and dereferenceable throught launder 2018-05-18 23:54:33 +00:00
dereferenceable-and-aligned.ll
func-ptr-lsb.ll [IR] Do not assume that function pointers are aligned 2018-04-27 09:12:12 +00:00
get-pointer-base-with-const-off.ll
invariant.group.ll Simplify recursive launder.invariant.group and strip 2018-07-12 23:55:20 +00:00
known-bits-from-range-md.ll
known-non-equal.ll
known-nonnull-at.ll Fix aliasing of launder.invariant.group 2018-05-23 09:16:44 +00:00
known-power-of-two.ll
known-signbit-shift.ll [ValueTracking] return zero when there's conflict in known bits of a shift (PR34838) 2017-10-12 17:31:46 +00:00
knownnonzero-shift.ll
knownzero-addrspacecast.ll
knownzero-shift.ll
memory-dereferenceable.ll Give up on array allocas in getPointerDereferenceableBytes 2017-12-20 10:01:30 +00:00
monotonic-phi.ll
non-negative-phi-bits.ll Revert "[InstCombine] Delay foldICmpUsingKnownBits until simple transforms are done" 2018-07-06 04:04:13 +00:00
pr23011.ll
select-pattern.ll [ValueTracking] add recursion depth param to matchSelectPattern 2018-01-24 15:20:37 +00:00
signbits-extract-elt.ll