forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; 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) |