[PATCH] D106749: [IR] Consider non-willreturn as side effect

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 24 08:44:28 PDT 2021


nikic created this revision.
nikic added reviewers: jdoerfert, fhahn.
Herald added subscribers: dexonsmith, asbirlea, javed.absar, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This adjusts `mayHaveSideEffect()` to return true for `!willReturn()` instructions. This fixes a number of cases where non-willreturn calls are currently handled incorrectly.

I performed a cursory review of all current `mayHaveSideEffect()` uses, which convinced me that these are indeed the desired 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 <https://reviews.llvm.org/D106591> and D106742 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106749

Files:
  llvm/include/llvm/IR/Instruction.h
  llvm/lib/Analysis/DemandedBits.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/Transforms/Scalar/ADCE.cpp
  llvm/test/Transforms/LICM/sinking.ll
  llvm/test/Transforms/LoopDeletion/noop-loops-with-subloops.ll
  llvm/test/Transforms/SCCP/calltest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106749.361459.patch
Type: text/x-patch
Size: 5211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210724/33a34da5/attachment.bin>


More information about the llvm-commits mailing list