This patch introduces no functional changes.
We used to treat GEPs like bitcasts and ignore the offsets. Such an approach is inadequate if we were to move to a field-sensitive analysis. We use accumulateConstantOffset() in this patch to keep track of field offsets in CFLGraphBuilder when the given gep can be decomposed into a base and a constant offset.
To call accumulateConstantOffset() we need to perform a cast to GEPOperator in visitGetElementPtrInst(). This cast will fail when visitGetElementPtrInst() gets a ConstantExpr disguised as a GetElementPtrInst as its argument. I'm not 100% sure what the reason for the casting failure is, but a deeper problem here is that we handle ConstantExprs by casting them into their corresponding Instructions, and such a treatment is very hacky and fragile. I ended up fixing the problem by rewriting visitConstExpr() and letting it do its job in a proper manner.
More patches on field-sensitivity will come in the near future.
IIRC, some MSVC versions we support don't have a constexpr max() function, so this will break those bots. Please either use a static LLVM_CONSTEXPR variable, or wrap this in a function. :)