-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add range attribute to scalar function results and arguments
- Loading branch information
Showing
9 changed files
with
115 additions
and
14 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
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
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
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,33 @@ | ||
// Checks that range metadata gets emitted on functions result and arguments | ||
// with scalar value. | ||
|
||
//@ compile-flags: -O -C no-prepopulate-passes | ||
//@ min-llvm-version: 19 | ||
|
||
#![crate_type = "lib"] | ||
|
||
use std::num::NonZero; | ||
|
||
// CHECK: noundef range(i64 1, 0) i64 @nonzero_int(i64 noundef range(i64 1, 0) %x) | ||
#[no_mangle] | ||
pub fn nonzero_int(x: NonZero<u64>) -> NonZero<u64> { | ||
x | ||
} | ||
|
||
// CHECK: noundef range(i8 0, 3) i8 @optional_bool(i8 noundef range(i8 0, 3) %x) | ||
#[no_mangle] | ||
fn optional_bool(x: Option<bool>) -> Option<bool> { | ||
x | ||
} | ||
|
||
pub enum Enum0 { | ||
A(bool), | ||
B, | ||
C, | ||
} | ||
|
||
// CHECK: noundef range(i8 0, 4) i8 @enum_value(i8 noundef range(i8 0, 4) %x) | ||
#[no_mangle] | ||
fn enum_value(x: Enum0) -> Enum0 { | ||
x | ||
} |
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