[all-commits] [llvm/llvm-project] 1b6041: [Attributor] `willreturn` + `noreturn` = UB

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Fri Nov 1 22:39:05 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b6041a9e8c537894dfda998fdd3d284b1111bd2
      https://github.com/llvm/llvm-project/commit/1b6041a9e8c537894dfda998fdd3d284b1111bd2
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2019-11-02 (Sat, 02 Nov 2019)

  Changed paths:
    M llvm/lib/Transforms/IPO/Attributor.cpp
    M llvm/test/Transforms/FunctionAttrs/fn_noreturn.ll
    M llvm/test/Transforms/FunctionAttrs/internal-noalias.ll
    M llvm/test/Transforms/FunctionAttrs/norecurse.ll

  Log Message:
  -----------
  [Attributor] `willreturn` + `noreturn` = UB

We gave up on `noreturn` if `willreturn` was known for a while but we
now again try to always derive `noreturn`. This is useful because a
function that is `noreturn` + `willreturn` is basically dead as
executing it would lead to undefined behavior (UB).

This came up in the IPConstantProp cases where a function only contained
a unreachable but was not marked `noreturn` which caused missed
opportunities down the line.




More information about the All-commits mailing list