Reland r341269. Previous commit has no deterministic order between two GEPs that share the same base GV and have the same offset but are of different types. Now we use std::stable_sort() for sorting constant candidates. Reverting commit, r341365: Revert r341269: [Constant Hoisting] Hoisting Constant GEP Expressions One of the tests is failing 50% of the time when expensive checks are enabled. Not sure how deep the problem is so just reverting while the author can investigate so that the bots stop repeatedly failing and blaming things incorrectly. Will respond with details on the original commit. Original commit, r341269: [Constant Hoisting] Hoisting Constant GEP Expressions Leverage existing logic in constant hoisting pass to transform constant GEP expressions sharing the same base global variable. Multi-dimensional GEPs are rewritten into single-dimensional GEPs. Differential Revision: https://reviews.llvm.org/D51396

# Details

Details

# Diff Detail

Diff Detail

- Repository
- rL LLVM

### Event Timeline

lib/Transforms/Scalar/ConstantHoisting.cpp | ||
---|---|---|

649 | This is unfortunately not true; it's possible to have an array of length 0 as a member of a struct. Can you just use stable_sort here, instead of trying to impose an ordering on GEPs with the same offset? |