This is an archive of the discontinued LLVM Phabricator instance.

[GVN] Don't coerce non-integral pointers to integers or vice versa
ClosedPublic

Authored by sanjoy on Apr 18 2017, 6:14 PM.

Details

Summary

See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

The NewGVN test does not fail without these changes (perhaps it does
try to coerce pointers <-> integers to begin with?), but I added the
test case anyway.

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy created this revision.Apr 18 2017, 6:14 PM
davide requested changes to this revision.Apr 18 2017, 8:09 PM
davide added a subscriber: davide.
davide added inline comments.
test/Transforms/NewGVN/non-integral-pointers.ll
25–28 ↗(On Diff #95668)

I think a test made only of CHECK-NOT is a little brittle. Can you expand it a bit?

This revision now requires changes to proceed.Apr 18 2017, 8:09 PM
sanjoy added inline comments.Apr 18 2017, 10:47 PM
test/Transforms/NewGVN/non-integral-pointers.ll
25–28 ↗(On Diff #95668)

I could expand it to CHECK for what GVN generates here (IIRC it does not do anything), but that would mislead the reader about the purpose of this test. This test is really intended to check that GVN did not generate inttoptr or ptrtoint, so I think a CHECK-NOT based test is appropriate here.

davide accepted this revision.Apr 19 2017, 7:19 AM
davide added inline comments.
test/Transforms/NewGVN/non-integral-pointers.ll
25–28 ↗(On Diff #95668)

Yes, it shouldn't do anything. Probably load coercion tests should cover other cases so, after a second look, I guess your CHECK lines are fine.

This revision is now accepted and ready to land.Apr 19 2017, 7:19 AM
This revision was automatically updated to reflect the committed changes.