Nikita Popov 205f7ee737 [Lint] Skip null args when checking noalias
Do not emit a warning if there are two null noalias arguments,
as they cannot be dereferenced anyway.

This is a common pattern for `@.omp_outlined`, which has some
optional noalias arguments.
2024-09-04 15:02:50 +02:00

15 lines
455 B
LLVM

; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck --allow-empty %s
declare void @foo(ptr noalias, ptr noalias)
define void @test() {
entry:
call void @foo(ptr null, ptr null)
ret void
}
; Lint should not complain about passing null to both arguments if they are
; null, since noalias only applies if the argument is written to, which is not
; possible for a null pointer.
; CHECK-NOT: Unusual: noalias argument aliases another argument