-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IPSCCP] Add tests for noundef attribute on zapped returns (NFC)
We replace the return value with undef without dropping the noundef attribute.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
; RUN: opt -S -passes=ipsccp < %s | FileCheck %s | ||
@g = external global i8 | ||
|
||
define internal noundef i32 @ret_noundef() { | ||
; CHECK-LABEL: define internal noundef i32 @ret_noundef() { | ||
; CHECK-NEXT: ret i32 undef | ||
; | ||
ret i32 0 | ||
} | ||
|
||
define internal dereferenceable(1) ptr @ret_dereferenceable() { | ||
; CHECK-LABEL: define internal dereferenceable(1) ptr @ret_dereferenceable() { | ||
; CHECK-NEXT: ret ptr undef | ||
; | ||
ret ptr @g | ||
} | ||
|
||
define internal dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() { | ||
; CHECK-LABEL: define internal dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() { | ||
; CHECK-NEXT: ret ptr undef | ||
; | ||
ret ptr @g | ||
} | ||
|
||
define internal nonnull ptr @ret_nonnull() { | ||
; CHECK-LABEL: define internal nonnull ptr @ret_nonnull() { | ||
; CHECK-NEXT: ret ptr undef | ||
; | ||
ret ptr @g | ||
} | ||
|
||
define internal nonnull noundef ptr @ret_nonnull_noundef() { | ||
; CHECK-LABEL: define internal noundef nonnull ptr @ret_nonnull_noundef() { | ||
; CHECK-NEXT: ret ptr undef | ||
; | ||
ret ptr @g | ||
} | ||
|
||
define void @test() { | ||
; CHECK-LABEL: define void @test() { | ||
; CHECK-NEXT: [[TMP1:%.*]] = call noundef i32 @ret_noundef() | ||
; CHECK-NEXT: [[TMP2:%.*]] = call dereferenceable(1) ptr @ret_dereferenceable() | ||
; CHECK-NEXT: [[TMP3:%.*]] = call dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() | ||
; CHECK-NEXT: [[TMP4:%.*]] = call nonnull ptr @ret_nonnull() | ||
; CHECK-NEXT: [[TMP5:%.*]] = call noundef nonnull ptr @ret_nonnull_noundef() | ||
; CHECK-NEXT: ret void | ||
; | ||
call noundef i32 @ret_noundef() | ||
call dereferenceable(1) ptr @ret_dereferenceable() | ||
call dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() | ||
call nonnull ptr @ret_nonnull() | ||
call nonnull noundef ptr @ret_nonnull_noundef() | ||
ret void | ||
} |