This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Move LVILatticeVal class to separate header file (NFC).
ClosedPublic

Authored by fhahn on Sep 7 2017, 1:43 PM.

Details

Summary

This allows sharing the lattice value code between LVI and SCCP (D36656).

It also adds a satisfiesPredicate function, used by D36656.

Diff Detail

Event Timeline

fhahn created this revision.Sep 7 2017, 1:43 PM
fhahn updated this revision to Diff 114254.Sep 7 2017, 1:57 PM
fhahn edited the summary of this revision. (Show Details)

Fix formatting issue

sanjoy edited edge metadata.Sep 7 2017, 2:36 PM

This isn't a "move" right, since you didn't delete the original?

fhahn added a comment.Sep 7 2017, 3:05 PM

This isn't a "move" right, since you didn't delete the original?

Err yes indeed, I did not upload the latest version of the diff :/ I'll upload the full diff tomorrow.

fhahn updated this revision to Diff 114379.Sep 8 2017, 9:47 AM

Remove duplicated code

sanjoy requested changes to this revision.Sep 9 2017, 2:04 PM
sanjoy added inline comments.
include/llvm/Analysis/ValueLattice.h
28

I think this should no longer be called LVILatticeVal, now that it is used outside LVI.

85

Since you're moving the code anyway, can you also run clang-format over this file?

180

Now that this lives outside LVI, we need to be clearer about what this actually does (modifies *this to approximate both *this and RHS).

234

This can also work for:

  • ConstantExpr for ICMP_EQ.
  • undefined
246

Why doesn't ConstantRange::makeSatisfyingICmpRegion work for ICMP_NE and ICMP_EQ?

Please also add a test case to unittests/ for this function.

This revision now requires changes to proceed.Sep 9 2017, 2:04 PM
fhahn updated this revision to Diff 116358.Sep 22 2017, 9:26 AM
fhahn edited edge metadata.
fhahn marked 4 inline comments as done.

@sanjoy thank you very much for the review and sorry for taking a while to update the patch.

fhahn added inline comments.Sep 23 2017, 11:36 AM
include/llvm/Analysis/ValueLattice.h
28

Agreed, I named it to ValueLatticeVal, which is slightly longer.

246

ConstantRange::makeSatisfyingICmpRegion works on those cases too, thanks! I've added unit tests too

sanjoy accepted this revision.Sep 24 2017, 8:47 PM

LGTM with nits

include/llvm/Analysis/ValueLattice.h
28

Let's call this ValueLatticeElement. It is a bit verbose, but I think it is to the point, and with auto the more verbose type name probably won't bite us as much.

177

Please elaborate on what "Merge" means in this context.

245

Is the LLVM_ATTRIBUTE_USED still needed?

This revision is now accepted and ready to land.Sep 24 2017, 8:47 PM
fhahn updated this revision to Diff 116952.Sep 28 2017, 2:49 AM

Thanks @sanjoy! Addressed nits

fhahn added inline comments.Sep 28 2017, 3:00 AM
include/llvm/Analysis/ValueLattice.h
245

Nope it is not I think. I've removed it.

fhahn closed this revision.Sep 28 2017, 4:10 AM