- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Fix RISC-V Test Failures in ./x test for Multiple Codegen and Assembly Cases #143792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      d3991c4
              
                Fix tests/codegen/const-vector.rs test failure on riscv64
              
              
                CaiWeiran 9f384ec
              
                Fix tests/codegen/enum/enum-aggregate.rs test failure on riscv64
              
              
                CaiWeiran b8729a2
              
                Fix tests/codegen/simd/extract-insert-dyn.rs test failure on riscv64
              
              
                CaiWeiran 287351a
              
                Fix tests/codegen/transmute-scalar.rs test failure on riscv64
              
              
                CaiWeiran ae3463e
              
                Fix tests/codegen/uninhabited-transparent-return-abi.rs test failure …
              
              
                CaiWeiran 26e28a8
              
                Fix tests/assembly/dwarf-mixed-versions-lto.rs test failure on riscv64
              
              
                CaiWeiran 29f6c9e
              
                Update and rename enum-aggregate-generic.rs to enum-aggregate.rs
              
              
                CaiWeiran 308203c
              
                Update and rename transmute-scalar-generic.rs to transmute-scalar.rs
              
              
                CaiWeiran File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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,127 @@ | ||
| //@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes | ||
| //@ min-llvm-version: 19 | ||
| //@ only-64bit | ||
| //@ only-riscv64 | ||
|  | ||
| #![crate_type = "lib"] | ||
|  | ||
| use std::cmp::Ordering; | ||
| use std::num::NonZero; | ||
| use std::ptr::NonNull; | ||
|  | ||
| #[no_mangle] | ||
| fn make_some_bool(x: bool) -> Option<bool> { | ||
| // CHECK-LABEL: i8 @make_some_bool(i1 zeroext %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: %[[WIDER:.+]] = zext i1 %x to i8 | ||
| // CHECK-NEXT: ret i8 %[[WIDER]] | ||
| Some(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_none_bool() -> Option<bool> { | ||
| // CHECK-LABEL: i8 @make_none_bool() | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret i8 2 | ||
| None | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_some_ordering(x: Ordering) -> Option<Ordering> { | ||
| // CHECK-LABEL: i8 @make_some_ordering(i8 signext %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret i8 %x | ||
| Some(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_some_u16(x: u16) -> Option<u16> { | ||
| // CHECK-LABEL: { i16, i16 } @make_some_u16(i16 zeroext %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: %0 = insertvalue { i16, i16 } { i16 1, i16 poison }, i16 %x, 1 | ||
| // CHECK-NEXT: ret { i16, i16 } %0 | ||
| Some(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_none_u16() -> Option<u16> { | ||
| // CHECK-LABEL: { i16, i16 } @make_none_u16() | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret { i16, i16 } { i16 0, i16 undef } | ||
| None | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_some_nzu32(x: NonZero<u32>) -> Option<NonZero<u32>> { | ||
| // CHECK-LABEL: i32 @make_some_nzu32(i32 signext %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret i32 %x | ||
| Some(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_ok_ptr(x: NonNull<u16>) -> Result<NonNull<u16>, usize> { | ||
| // CHECK-LABEL: { i64, ptr } @make_ok_ptr(ptr %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: %0 = insertvalue { i64, ptr } { i64 0, ptr poison }, ptr %x, 1 | ||
| // CHECK-NEXT: ret { i64, ptr } %0 | ||
| Ok(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_ok_int(x: usize) -> Result<usize, NonNull<u16>> { | ||
| // CHECK-LABEL: { i64, ptr } @make_ok_int(i64 %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: %[[NOPROV:.+]] = getelementptr i8, ptr null, i64 %x | ||
| // CHECK-NEXT: %[[R:.+]] = insertvalue { i64, ptr } { i64 0, ptr poison }, ptr %[[NOPROV]], 1 | ||
| // CHECK-NEXT: ret { i64, ptr } %[[R]] | ||
| Ok(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_some_ref(x: &u16) -> Option<&u16> { | ||
| // CHECK-LABEL: ptr @make_some_ref(ptr align 2 %x) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret ptr %x | ||
| Some(x) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_none_ref<'a>() -> Option<&'a u16> { | ||
| // CHECK-LABEL: ptr @make_none_ref() | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: ret ptr null | ||
| None | ||
| } | ||
|  | ||
| #[inline(never)] | ||
| fn make_err_generic<E>(e: E) -> Result<u32, E> { | ||
| // CHECK-LABEL: define{{.+}}make_err_generic | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: call void @llvm.trap() | ||
| // CHECK-NEXT: ret i32 poison | ||
| Err(e) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_uninhabited_err_indirectly(n: Never) -> Result<u32, Never> { | ||
| // CHECK-LABEL: i32 @make_uninhabited_err_indirectly() | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: call{{.+}}make_err_generic | ||
| make_err_generic(n) | ||
| } | ||
|  | ||
| #[no_mangle] | ||
| fn make_fully_uninhabited_result(v: u32, n: Never) -> Result<(u32, Never), (Never, u32)> { | ||
| // Actually reaching this would be UB, so we don't actually build a result. | ||
|  | ||
| // CHECK-LABEL: { i32, i32 } @make_fully_uninhabited_result(i32 signext %v) | ||
| // CHECK-NEXT: start: | ||
| // CHECK-NEXT: call void @llvm.trap() | ||
| // CHECK-NEXT: call void @llvm.trap() | ||
| // CHECK-NEXT: call void @llvm.trap() | ||
| // CHECK-NEXT: unreachable | ||
| Ok((v, n)) | ||
| } | ||
|  | ||
| enum Never {} | ||
  
    
      This file contains hidden or 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 hidden or 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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why split this out to a separate file? Skimming the contents I don't see major differences vs the existing file. Maybe we could use revisions instead if there's a few small differences (see tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs for example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference lies in the // CHECK lines. Would it be possible to separate them using revisions?