[all-commits] [llvm/llvm-project] 67cb8f: [NFC][SimplifyCFG] Add test w/ shared normal dest ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Fri Feb 4 15:58:43 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67cb8fd75b55141da81fbc01ca5141ca3272acda
      https://github.com/llvm/llvm-project/commit/67cb8fd75b55141da81fbc01ca5141ca3272acda
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-05 (Sat, 05 Feb 2022)

  Changed paths:
    M llvm/test/Transforms/SimplifyCFG/invoke.ll

  Log Message:
  -----------
  [NFC][SimplifyCFG] Add test w/ shared normal dest of a `noreturn` `invoke`d function


  Commit: 18ff1ec3c3c63889e476c5495647de41ac2870aa
      https://github.com/llvm/llvm-project/commit/18ff1ec3c3c63889e476c5495647de41ac2870aa
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-05 (Sat, 05 Feb 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp
    M llvm/test/CodeGen/X86/catchret-regmask.ll
    M llvm/test/Transforms/SimplifyCFG/invoke.ll

  Log Message:
  -----------
  Reland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`

As per LangRef's definition of `noreturn` attribute:
```
noreturn
  This function attribute indicates that the function never returns
  normally, hence through a return instruction.
  This produces undefined behavior at runtime if the function
  ever does dynamically return. nnotated functions may still
  raise an exception, i.a., nounwind is not implied.
```

So if we `invoke` a `noreturn` function, and the normal destination
of an invoke is not an `unreachable`, point it at the new `unreachable`
block.

The change/fix from the original commit is that we now actually create
the new block, and don't just repurpose the original block,
because said normal destination block could have other users.

This reverts commit db1176ce66cf276b45ac3b90ea6b5ce62de56be7,
relanding commit 598833c987593ce192fa827f162cae8c867c9d43.


Compare: https://github.com/llvm/llvm-project/compare/194b164eb51e...18ff1ec3c3c6


More information about the All-commits mailing list