[all-commits] [llvm/llvm-project] b6a0be: [SimplifyCFG] Check if the return instruction caus...

DianQK via All-commits all-commits at lists.llvm.org
Tue Feb 21 05:44:19 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b6a0be8ce3114d0c57e7a7d6c3c222986ca506ad
      https://github.com/llvm/llvm-project/commit/b6a0be8ce3114d0c57e7a7d6c3c222986ca506ad
  Author: DianQK <dianqk at dianqk.net>
  Date:   2023-02-21 (Tue, 21 Feb 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    A llvm/test/Transforms/SimplifyCFG/unreachable-eliminate-on-ret.ll

  Log Message:
  -----------
  [SimplifyCFG] Check if the return instruction causes undefined behavior

This should fix https://github.com/rust-lang/rust/issues/107681.

Return undefined to a noundef return value is undefined.

Example:

```
define noundef i32 @test_ret_noundef(i1 %cond) {
entry:
  br i1 %cond, label %bb1, label %bb2
bb1:
  br label %bb2
bb2:
  %r = phi i32 [ undef, %entry ], [ 1, %bb1 ]
  ret i32 %r
}
```

Reviewed By: nikic

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




More information about the All-commits mailing list