mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	 a5fa12b6b9
			
		
	
	
		a5fa12b6b9
		
	
	
	
	
		
			
			This way LLVM will set the string merging flag if the alloc is a nul terminated string, reducing binary sizes.
		
			
				
	
	
		
			16 lines
		
	
	
		
			300 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			300 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ compile-flags: -Copt-level=3
 | |
| 
 | |
| #![crate_type = "lib"]
 | |
| 
 | |
| const LUT: [u8; 4] = [1, 1, 1, 1];
 | |
| 
 | |
| // CHECK-LABEL: @decode
 | |
| #[no_mangle]
 | |
| pub fn decode(i: u8) -> u8 {
 | |
|     // CHECK: start:
 | |
|     // CHECK-NEXT: icmp
 | |
|     // CHECK-NEXT: select
 | |
|     // CHECK-NEXT: ret
 | |
|     if i < 4 { LUT[i as usize] } else { 2 }
 | |
| }
 |