HomePhabricator

[NFCI][IR] ConstantRangeTest: add basic scaffolding for next-gen…

Authored by lebedev.ri on Sep 24 2020, 2:30 PM.

Description

[NFCI][IR] ConstantRangeTest: add basic scaffolding for next-gen precision/correctness testing

I have long complained that while we have exhaustive tests
for ConstantRange, they are, uh, not good.

The approach of groking our own constant range
via exhaustive enumeration is, mysterious.

It neither tells us without doubt that the result is
conservatively correct, nor the precise match to the ConstantRange
result tells us that the result is precise.
But yeah, it's fast, i give it that.

In short, there are three things that we need to check:

  1. That ConstantRange result is conservatively correct
  2. That ConstantRange range is reasonable
  3. That ConstantRange result is reasonably precise

So let's not just check the middle one, but all three.

This provides precision test coverage for D88178.

Event Timeline

MaskRay added inline comments.
/llvm/unittests/IR/ConstantRangeTest.cpp
141

g++ 9 and 10 have internal errors on 1 << Bits