[llvm] [Attributor][FIX] Fix NonNull deduction bug. (PR #85810)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 18:29:43 PDT 2024


lcvon007 wrote:

```C++
@G = internal global i64 1, align 8
define dso_local ptr @update_global_in_alive_bb() {
entry:
  %0 = load i64, ptr @G, align 8
  %cmp = icmp ne i64 %0, 0
  br i1 %cmp, label %if.then, label %if.else
if.then:
  store i64 0, ptr @G, align 8
  ret ptr inttoptr (i64 5 to ptr)
if.else:
  ret ptr null
}
```
It can not defer nonull attribute for this function(Call this function twice will get different result.), but the compiler consider it's nonnull return.

https://github.com/llvm/llvm-project/pull/85810


More information about the llvm-commits mailing list