If OptimizeExtractBits() encountered a shift instruction with no operands at all, it would erase the instruction, but still return false. This previously didn’t matter because its caller would always return after processing the instruction, but https://reviews.llvm.org/D63233 changed the function’s caller to fall through if it returned false, which would then cause a use-after-free detectable by ASAN.
This change makes OptimizeExtractBits return true if it removes a shift instruction with no users, terminating processing of the instruction.
Alternative to this patch: act on that TODO.