Non-standard integer size in SelectionDAG

I’m considering an optimization that would depend on llvm.assume information be present in SelectionDAG, preferrably in the form of KnownBits.

For instance:

__builtin_assume(k < 1u << 29);

would mark unsigned k as a 29-bit number.

Unfortunately CodeGenPrepare::eliminateAssumptions removes llvm.assume and the information seems to be lost. Am I missing something?
Are there any alternatives?

You could add a hook TargetLoweringInfo::shouldPreserveAssumes or something like that, that returns false by default, and guard the assume elimination with that.

For development/testing purposes you can just add a debug option to CodeGenPrepare…