llvm-project/llvm/test/Analysis/Lint/noalias-readnone.ll
Bjorn Pettersson c068284087 [Lint] Permit aliasing noalias and readnone arguments
If an argument is readnone we know that it isn't dereferenced. Then
it should be OK if that argument alias with a noalias argument.

Differential Revision: https://reviews.llvm.org/D157737
2023-08-14 14:11:17 +02:00

15 lines
447 B
LLVM

; RUN: opt < %s -passes=lint -disable-output 2>&1 | FileCheck --allow-empty %s
declare void @foo1(ptr noalias, ptr readnone)
define void @test1(ptr %a) {
entry:
call void @foo1(ptr %a, ptr %a)
ret void
}
; Lint should not complain about passing %a to both arguments even if one is
; noalias, since the second argument is readnone.
; CHECK-NOT: Unusual: noalias argument aliases another argument
; CHECK-NOT: call void @foo1(ptr %a, ptr %a)