-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Nikita Popov <[email protected]>
- Loading branch information
Showing
11 changed files
with
30 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
//@ compile-flags: -O | ||
// XXX: The x86-64 assembly get optimized correclty. But llvm-ir output is not until llvm 18? | ||
//@ min-llvm-version: 18 | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub enum K{ | ||
pub enum K { | ||
A(Box<[i32]>), | ||
B(Box<[u8]>), | ||
C(Box<[String]>), | ||
D(Box<[u16]>), | ||
} | ||
|
||
#[no_mangle] | ||
// CHECK-LABEL: @get_len | ||
// CHECK: getelementptr inbounds | ||
// CHECK-NEXT: load | ||
// CHECK-NEXT: ret i64 | ||
// CHECK-NOT: switch | ||
pub fn get_len(arg: &K)->usize{ | ||
#[no_mangle] | ||
pub fn get_len(arg: &K) -> usize { | ||
match arg { | ||
K::A(ref lst)=>lst.len(), | ||
K::B(ref lst)=>lst.len(), | ||
K::C(ref lst)=>lst.len(), | ||
K::D(ref lst)=>lst.len(), | ||
K::A(ref lst) => lst.len(), | ||
K::B(ref lst) => lst.len(), | ||
K::C(ref lst) => lst.len(), | ||
K::D(ref lst) => lst.len(), | ||
} | ||
} |
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