Avoid crashes from zero-byte values due to sub-byte store sizes.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
15436 ↗ | (On Diff #188177) | This is overly optimistic: for example, this will return true for STBitSize = 1 and ChainBitSize= 2 if both are at offset 0 What about passing size in bits to BaseIndexOffset::contains() and letting it do the computation in bits: bool BaseIndexOffset::contains(int64_t BitSize, const BaseIndexOffset &Other, int64_t OtherBitSize, const SelectionDAG &DAG, int64_t &Offset) const { if (!equalBaseIndex(Other, DAG, Offset)) return false; if (Offset >= 0) { // Other is after *this: // [-------*this---------] // [---Other--] // ==Offset==> return 8 * Offset + OtherBitSize <= BitSize; } // Other starts strictly before *this, it cannot be fully contained. // [-------*this---------] // [--Other--] return false; } |
Comment Actions
Convert to bit-level sizing for contains. I'm leaving equalBaseIndex as byte-level for now, but a followup NFC patch is probably warranted.
Comment Actions
Nice! I ran a new bunch of llvm-stress tests with this patch and now I don't see the crashes anymore.
Please push.