This is an archive of the discontinued LLVM Phabricator instance.

[ValueLattice] Update markConstantRange to return false for subset ranges.
ClosedPublic

Authored by fhahn on Jan 22 2020, 3:37 PM.

Details

Summary

Currently we always return true, when markConstantRange is used on an
object already containing a constant range. If NewR is equal to the
existing constant range however, nothing changes and we should return
false.

I also went ahead and added a clarifying comment and improved the
assertion.

Diff Detail

Event Timeline

fhahn created this revision.Jan 22 2020, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 3:37 PM

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: diff.json, console-log.txt

efriedma added inline comments.Jan 22 2020, 6:18 PM
llvm/include/llvm/Analysis/ValueLattice.h
229

If NewR is precisely equal to the current range, it makes sense to do nothing. It doesn't make sense to call markConstantRange with a NewR that's a subset of the current range.

fhahn updated this revision to Diff 239765.Jan 22 2020, 6:58 PM

Restrict input for markConstantRange to either matching the existing constant range or being a superset.

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: diff.json, console-log.txt

fhahn edited the summary of this revision. (Show Details)Jan 22 2020, 7:05 PM
fhahn marked an inline comment as done.
fhahn added inline comments.
llvm/include/llvm/Analysis/ValueLattice.h
229

Right, I've restricted the acceptable values of NewR and also updated the description.

This revision is now accepted and ready to land.Jan 23 2020, 8:12 AM
This revision was automatically updated to reflect the committed changes.