This is an archive of the discontinued LLVM Phabricator instance.

[ValueLattice] Make mark* functions public, return if value changed.
ClosedPublic

Authored by fhahn on Apr 11 2019, 1:55 PM.

Details

Summary

This patch prepares ValueLatticeElement to be used by SCCP, by:

  • making the mark* functions public
  • make the mark* functions return a bool indicating if the value has changed.

Diff Detail

Event Timeline

fhahn created this revision.Apr 11 2019, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2019, 1:55 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

I'm not necessarily sure I like this. It's simply spreading in a general framework a concept that shouldn't exist to begin with. I'd rather remove forced constant from SCCP, even though it might result in us losing some optimization power.

I'm not necessarily sure I like this. It's simply spreading in a general framework a concept that shouldn't exist to begin with. I'd rather remove forced constant from SCCP, even though it might result in us losing some optimization power.

Right, I am happy to go in that direction as well.

fhahn added a comment.Apr 30 2019, 7:57 AM

I've put up a commit removing forcedconstant on top of the integer range support: D61314. This is mostly to have an easy way to compare the impact of forcedconstant and could be folded in the integer range support. But maybe it is easier to review/commit/test as separate steps.

fhahn updated this revision to Diff 235028.Dec 21 2019, 2:39 PM

Rebased

Unit tests: pass. 61085 tests passed, 0 failed and 728 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

fhahn retitled this revision from [ValueLattice] Add forceconstant, for SCCP. to [ValueLattice] Make mark* functions public, return if value changed..Feb 9 2020, 12:02 PM
fhahn edited the summary of this revision. (Show Details)
fhahn added a reviewer: nikic.
fhahn updated this revision to Diff 243457.Feb 9 2020, 12:03 PM

Strip forcedconstant changes.

nikic added inline comments.Feb 9 2020, 2:13 PM
llvm/include/llvm/Analysis/ValueLattice.h
288

I'm confused -- how can this method ever return non-null? Isn't ConstantInt canonicalized to ranges?

304

And related to the previous comment: Why are these changes needed? This shouldn't happen.

fhahn updated this revision to Diff 243573.Feb 10 2020, 8:21 AM

Remove getConstantInt changes, removed in D74329.

fhahn marked an inline comment as done.Feb 10 2020, 8:22 AM
fhahn added inline comments.
llvm/include/llvm/Analysis/ValueLattice.h
288

Right, it looks like getConstantInt was an unused left-over. I've put up a patch to remove it: D74329

nikic added inline comments.Feb 10 2020, 11:22 AM
llvm/include/llvm/Analysis/ValueLattice.h
184–185

I believe this assert is useless after the isa<>. Can either be dropped or the previous order restored (not sure why it was changed?)

310

Looks like this can now be reverted to the previous code (which avoids the awkward empty initializations...)

fhahn updated this revision to Diff 243812.Feb 11 2020, 4:38 AM

Address comments: remove unnecessary assert, undo unnnecessary changes in getCompare.

nikic accepted this revision.Feb 11 2020, 5:13 AM

LGTM

This revision is now accepted and ready to land.Feb 11 2020, 5:13 AM
fhahn added a comment.Feb 11 2020, 1:28 PM

Thanks for taking a look. I plan to land this, once D60582 has been accepted as well.

This revision was automatically updated to reflect the committed changes.