I think it may be good to remove Schrage's algorithm altogether and file an LWG issue for the remaining edge cases. It is very slow and feels out of place in LCG. Additionally, Schrage's algorithm introduces lot's of added complexity and space for bugs.
I guess getAs and castAs methods could join the party too. I'm evaluating plenty of results on LLVM, and those seem to be in the same problem category.
- removing unnecessary llvm_debug
Rebased and added more tests.
Added IntToPtrInst to case statement in Value::getPointerDereferenceableBytes
Changed LangRef.rst to reflect !dereferenceable is applicable to pointer types not
just load types.
Fix copy/paste mistake in comment
Are you planning to teach Value::getPointerDereferenceableBytes about this? The rest of the pipeline "should" then "just work" and use the information.
Updated error comment and case error test