This patch does the following things:
- update SymbolicallyEvaluateGEP so that it bails out if it cannot preserve inrange arribute;
- update llvm/test/Analysis/ConstantFolding/gep.ll to remove UB in it;
- remove inaccurate comment above ConstantFoldInstOperandsImpl in llvm/lib/Analysis/ConstantFolding.cpp;
- add a new regression test that makes sure that no optimizations change an inrange GEP in an unexpected way.
I think this TODO is no longer accurate: we *are* being passed the instruction/constant in InstOrCE , so we end up preserving inbounds and inrange and could preserve nsw/nuw if we chose. I would remove it.