Fix #2609 - Handle out-of-bounds scalar replacements. (#2767)
* Fix #2609 - Handle out-of-bounds scalar replacements. When SROA tries to do a replacement for an OpAccessChain that is exactly one element out of bounds, the code was trying to access its internal array of replacements and segfaulting. This protects the code from doing this, and it additionally fixes the way SROA works by not returning failure when it refuses to do a replacement. Instead of failing the optimization pass, SROA will now simply refuse to do the replacement and keep going. Additionally, this patch fixes the SROA logic to now return a proper status so we can correctly state that the pass made no changes to the IR if it only found invalid references.
Loading
Please register or sign in to comment