[all-commits] [llvm/llvm-project] a0c1b5: Reland "[SimplifyCFG] Check if the return instruct...

Quentin Dian via All-commits all-commits at lists.llvm.org
Wed Jan 24 14:43:00 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0c1b5bdda91920a66f58b0a891c551acff2d2a1
      https://github.com/llvm/llvm-project/commit/a0c1b5bdda91920a66f58b0a891c551acff2d2a1
  Author: DianQK <dianqk at dianqk.net>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

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

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

This relands commit b6a0be8ce3114d0c57e7a7d6c3c222986ca506ad.

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
}
```


  Commit: a58dcc5e08665f2d58a28c9d4510cf94de6ed3bf
      https://github.com/llvm/llvm-project/commit/a58dcc5e08665f2d58a28c9d4510cf94de6ed3bf
  Author: DianQK <dianqk at dianqk.net>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

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

  Log Message:
  -----------
  Reland "[SimplifyCFG] Improve the precision of `PtrValueMayBeModified`"

This relands commit f890f010f6a70addbd885acd0c8d1b9578b6246f.

The result value of `getelementptr inbounds (TY, null, not zero)` is a poison value.
We can think of it as undefined behavior.


Compare: https://github.com/llvm/llvm-project/compare/6384b6239b45...a58dcc5e0866


More information about the All-commits mailing list