This is an archive of the discontinued LLVM Phabricator instance.

Propagate nonnull and dereferenceable throught launder
ClosedPublic

Authored by Prazek on May 16 2018, 12:41 PM.

Details

Summary

invariant.group.launder should not stop propagation
of nonnull and dereferenceable, because e.g. we would not be
able to hoist loads speculatively.

Diff Detail

Event Timeline

Prazek created this revision.May 16 2018, 12:41 PM
xbolva00 accepted this revision.May 16 2018, 1:21 PM

Looks good

This revision is now accepted and ready to land.May 16 2018, 1:21 PM
hfinkel accepted this revision.May 16 2018, 5:04 PM

I also think that this is fine. Regarding hoisting, will we hoist the intrinsic itself or is further work necessary to enable that?

I also think that this is fine. Regarding hoisting, will we hoist the intrinsic itself or is further work necessary to enable that?

define void @foo(i8* %ptr) {
entry:
  br label %loop
 
loop:
  %x = phi i8 [ 0, %entry ], [ %x.inc, %loop ]
  %p = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr)
  %val = load i8, i8* %p
  %x.inc = add i8 %x, %val
  br label %loop
}

is not curently hoisted by LICM, so I guess we will have to fix it.
But I have working patch for hoisting invariant.group loads:
https://reviews.llvm.org/D45151

This revision was automatically updated to reflect the committed changes.