- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Replace OffsetOf by an actual sum of calls to intrinsic. #148151
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
base: master
Are you sure you want to change the base?
Conversation
0dc894f    to
    e46804b      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
e46804b    to
    8f24a32      
    Compare
  
    | 
           @bors try @rust-timer queue  | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
Replace OffsetOf by an actual sum of calls to intrinsic.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           Finished benchmarking commit (7721497): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy. 
 Max RSS (memory usage)Results (secondary -1.9%)A less reliable metric. May be of interest, but not used to determine the overall result above. 
 CyclesResults (secondary -0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above. 
 Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.876s -> 473.729s (-0.03%)  | 
    
| 
           ☔ The latest upstream changes (presumably #148324) made this pull request unmergeable. Please resolve the merge conflicts.  | 
    
875c6f6    to
    9fd16d6      
    Compare
  
    | 
           Some changes occurred in match checking cc @Nadrieril Some changes occurred to the CTFE machinery 
 cc @rust-lang/wg-const-eval Some changes occurred to constck cc @fee1-dead Some changes occurred in src/tools/clippy cc @rust-lang/clippy This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a Some changes occurred in  cc @BoxyUwU Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @vakaras Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_ssa This PR changes a file inside   | 
    
| 
           What's the justification/benefit for doing this, and what user facing impact does it have (i.e. why does it need a lang nomination)?  | 
    
| 
           My justification is simplifying MIR. This feature was implemented as a specific MIR statement, but does not need to, an intrinsic is sufficient. There should be no user-facing change because of the  However, there are 2 user-facing changes in this PR that t-lang may want to know: 
  | 
    
          
 Couldn't we encode this as a generic constant so that we don't need the intrinsic/ignore it in codegen?  | 
    
          
 This is what is done yes.  | 
    
This PR changes the way we compute the value of the
offset_of!macro in MIR. The current implementation uses a dedicated MIR rvalue.This PR proposes to replace it by an inline constant which sums calls to a new intrinsic
offset_of(variant index, field index). The desugaring is done at THIR building time, easier that doing it on MIR.The new intrinsic is only meant to be used by const-eval. LLVM codegen will refuse to generate code for it.
We replace:
By:
The second commit modifies intrinsic const checking to take
allow_internal_unstableinto account. The new intrinsic should only be called from stableoffset_of!macro. The intrinsic itself is unstable, const-unstable, butrustc_intrinsic_const_stable_indirect.Fixes #123959
Fixes #125680
Fixes #129425
Fixes #136175
r? @ghost