HomePhabricator

[IR] Consider non-willreturn as side effect (PR50511)

Authored by nikic on Jul 21 2021, 12:23 PM.

Description

[IR] Consider non-willreturn as side effect (PR50511)

This adjusts mayHaveSideEffect() to return true for !willReturn()
instructions. Just like other side-effects, non-willreturn calls
(aka "divergence") cannot be removed and cannot be reordered relative
to other side effects. This fixes a number of bugs where
non-willreturn calls are either incorrectly dropped or moved. In
particular, it also fixes the last open problem in
https://bugs.llvm.org/show_bug.cgi?id=50511.

I performed a cursory review of all current mayHaveSideEffect()
uses, which convinced me that these are indeed the desired default
semantics. Places that do not want to consider non-willreturn as a
sideeffect generally do not want mayHaveSideEffect() semantics at
all. I identified two such cases, which are addressed by D106591
and D106742. Finally, there is a use in SCEV for which we don't
really have an appropriate API right now -- what it wants is
basically "would this be considered forward progress". I've just
spelled out the previous semantics there.

Differential Revision: https://reviews.llvm.org/D106749

Details

Committed
nikicJul 26 2021, 7:35 AM
Differential Revision
D106749: [IR] Consider non-willreturn as side effect (PR50511)
Parents
rG404f0d4f7cc7: Simplify away some SmallVector copies. NFCI.
Branches
Unknown
Tags
Unknown