Skip to content
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

Apply EarlyOtherwiseBranch to scalar value #129047

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Aug 13, 2024

In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here.

r? @cjgillot

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 13, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 13, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@bors
Copy link
Contributor

bors commented Sep 9, 2024

☔ The latest upstream changes (presumably #130165) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot
Copy link
Contributor

r=me after rebase

@DianQK DianQK force-pushed the early_otherwise_branch_scalar branch from f8ebe31 to e3a9eaf Compare September 18, 2024 14:00
@DianQK
Copy link
Member Author

DianQK commented Sep 18, 2024

Rebased.
This reverts the change of early_otherwise_branch.rs in #129929. cc @nnethercote

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 22, 2024

📌 Commit e3a9eaf has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 22, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 23, 2024
…, r=cjgillot

Apply `EarlyOtherwiseBranch` to scalar value

In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here.

r? `@cjgillot`
@bors
Copy link
Contributor

bors commented Sep 23, 2024

⌛ Testing commit e3a9eaf with merge ec80a37...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [codegen] tests/codegen/issues/issue-111508-vec-tryinto-array.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/issues/issue-111508-vec-tryinto-array/issue-111508-vec-tryinto-array.ll" "/checkout/tests/codegen/issues/issue-111508-vec-tryinto-array.rs" "--check-prefix=CHECK" "--check-prefix" "NONMSVC" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
/checkout/tests/codegen/issues/issue-111508-vec-tryinto-array.rs:12:15: error: CHECK-NOT: excluded string found in input
/checkout/tests/codegen/issues/issue-111508-vec-tryinto-array.rs:12:15: error: CHECK-NOT: excluded string found in input
// CHECK-NOT: unwrap_failed
              ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/issues/issue-111508-vec-tryinto-array/issue-111508-vec-tryinto-array.ll:161:24: note: found here
; invoke core::result::unwrap_failed

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/issues/issue-111508-vec-tryinto-array/issue-111508-vec-tryinto-array.ll
Check file: /checkout/tests/codegen/issues/issue-111508-vec-tryinto-array.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
        .
        .
        .
        .
       61:  tail call void @__rust_dealloc(ptr noundef nonnull %self3.i.i.i.i3, i64 noundef %_5.i.i.i.i1, i64 noundef 1) #8, !noalias !24 
       62:  br label %"_ZN4core3ptr53drop_in_place$LT$alloc..raw_vec..RawVec$LT$u8$GT$$GT$17h18b90d2aed168b5cE.exit4" 
       63:  
       64: "_ZN4core3ptr53drop_in_place$LT$alloc..raw_vec..RawVec$LT$u8$GT$$GT$17h18b90d2aed168b5cE.exit4": ; preds = %bb4, %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2" 
       65:  ret void 
       66: } 
       67:  
       68: ; <alloc::vec::Vec<T,A> as core::fmt::Debug>::fmt 
       69: ; Function Attrs: nonlazybind uwtable 
       70: define internal noundef zeroext i1 @"_ZN65_$LT$alloc..vec..Vec$LT$T$C$A$GT$$u20$as$u20$core..fmt..Debug$GT$3fmt17ha3a5f891ff49c05aE"(ptr noalias nocapture noundef readonly align 8 dereferenceable(24) %self, ptr noalias noundef align 8 dereferenceable(64) %f) unnamed_addr #0 personality ptr @rust_eh_personality { 
       71: start: 
       72:  %entry.i.i = alloca [8 x i8], align 8 
       73:  %_5.i = alloca [16 x i8], align 8 
       74:  %self1 = load ptr, ptr %self, align 8, !nonnull !3, !noundef !3 
       75:  %0 = getelementptr inbounds i8, ptr %self, i64 16 
       76:  %len = load i64, ptr %0, align 8, !noundef !3 
       77:  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %_5.i), !noalias !25 
       78: ; call core::fmt::Formatter::debug_list 
       79:  call void @_ZN4core3fmt9Formatter10debug_list17hde3d95a55a067d9dE(ptr noalias nocapture noundef nonnull sret([16 x i8]) align 8 dereferenceable(16) %_5.i, ptr noalias noundef nonnull align 8 dereferenceable(64) %f), !noalias !29 
       80:  %_11.i = getelementptr inbounds i8, ptr %self1, i64 %len 
       81:  %1 = icmp eq i64 %len, 0 
       82:  br i1 %1, label %"_ZN48_$LT$$u5b$T$u5d$$u20$as$u20$core..fmt..Debug$GT$3fmt17h956362543c5fafecE.exit", label %bb5.i.i 
       83:  
       84: bb5.i.i: ; preds = %start, %bb5.i.i 
       85:  %iter.sroa.4.06.i.i = phi ptr [ %_24.i.i.i, %bb5.i.i ], [ %self1, %start ] 
       86:  %_24.i.i.i = getelementptr inbounds i8, ptr %iter.sroa.4.06.i.i, i64 1 
       87:  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %entry.i.i), !noalias !30 
       88:  store ptr %iter.sroa.4.06.i.i, ptr %entry.i.i, align 8, !noalias !30 
       89: ; call core::fmt::builders::DebugList::entry 
       90:  %_9.i.i = call noundef align 8 dereferenceable(16) ptr @_ZN4core3fmt8builders9DebugList5entry17h75b8b82a9fc5be91E(ptr noalias noundef nonnull align 8 dereferenceable(16) %_5.i, ptr noundef nonnull align 1 %entry.i.i, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @vtable.0) 
       91:  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %entry.i.i), !noalias !30 
       92:  %2 = icmp eq ptr %_24.i.i.i, %_11.i 
       93:  br i1 %2, label %"_ZN48_$LT$$u5b$T$u5d$$u20$as$u20$core..fmt..Debug$GT$3fmt17h956362543c5fafecE.exit", label %bb5.i.i 
       94:  
       95: "_ZN48_$LT$$u5b$T$u5d$$u20$as$u20$core..fmt..Debug$GT$3fmt17h956362543c5fafecE.exit": ; preds = %bb5.i.i, %start 
       96: ; call core::fmt::builders::DebugList::finish 
       97:  %_0.i = call noundef zeroext i1 @_ZN4core3fmt8builders9DebugList6finish17h5240307549155e39E(ptr noalias noundef nonnull align 8 dereferenceable(16) %_5.i) 
       98:  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %_5.i), !noalias !25 
       99:  ret i1 %_0.i 
      100: } 
      101:  
      102: ; Function Attrs: nonlazybind uwtable 
      103: define noundef i8 @example(ptr noalias nocapture noundef readonly align 8 dereferenceable(24) %a) unnamed_addr #0 personality ptr @rust_eh_personality { 
      104: start: 
      105:  %e.i = alloca [24 x i8], align 8 
      106:  %_5.sroa.5 = alloca [16 x i8], align 8 
      107:  %0 = getelementptr inbounds i8, ptr %a, i64 16 
      108:  %_2 = load i64, ptr %0, align 8, !noundef !3 
      109:  %1 = icmp eq i64 %_2, 32 
      110:  br i1 %1, label %bb2, label %bb1 
      111:  
      112: bb2: ; preds = %start 
      113:  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %_5.sroa.5) 
      114:  %_5.sroa.0.0.copyload = load ptr, ptr %a, align 8 
      115:  %_5.sroa.5.0.a.sroa_idx = getelementptr inbounds i8, ptr %a, i64 8 
      116:  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %_5.sroa.5, ptr noundef nonnull align 8 dereferenceable(16) %_5.sroa.5.0.a.sroa_idx, i64 16, i1 false) 
      117:  tail call void @llvm.experimental.noalias.scope.decl(metadata !33) 
      118:  tail call void @llvm.experimental.noalias.scope.decl(metadata !36) 
      119:  %_5.sroa.5.8.sroa_idx = getelementptr inbounds i8, ptr %_5.sroa.5, i64 8 
      120:  %_5.sroa.5.8._5.sroa.5.8._5.sroa.5.8._5.sroa.5.16._3.i = load i64, ptr %_5.sroa.5.8.sroa_idx, align 8 
      121:  %_2.not.i = icmp eq i64 %_5.sroa.5.8._5.sroa.5.8._5.sroa.5.8._5.sroa.5.16._3.i, 32 
      122:  br i1 %_2.not.i, label %bb6.i, label %bb2.i 
      123:  
      124: bb6.i: ; preds = %bb2 
      125:  %2 = icmp ne ptr %_5.sroa.0.0.copyload, null 
      126:  tail call void @llvm.assume(i1 %2) 
      127:  %_4.sroa.9.1.self.i.sroa_idx = getelementptr inbounds i8, ptr %_5.sroa.0.0.copyload, i64 15 
      128:  %_4.sroa.9.1.copyload = load i8, ptr %_4.sroa.9.1.self.i.sroa_idx, align 1, !noalias !36 
      129:  %_4.sroa.11.1.self.i.sroa_idx = getelementptr inbounds i8, ptr %_5.sroa.0.0.copyload, i64 24 
      130:  %_4.sroa.11.1.copyload = load i8, ptr %_4.sroa.11.1.self.i.sroa_idx, align 1, !noalias !36 
      131:  tail call void @llvm.experimental.noalias.scope.decl(metadata !38) 
      132:  tail call void @llvm.experimental.noalias.scope.decl(metadata !41) 
      133:  tail call void @llvm.experimental.noalias.scope.decl(metadata !44) 
      134:  tail call void @llvm.experimental.noalias.scope.decl(metadata !47) 
      135:  %_5.sroa.5.0._5.sroa.5.0._5.sroa.5.0._5.sroa.5.8._5.i.i.i.i1.i.i = load i64, ptr %_5.sroa.5, align 8, !alias.scope !50, !noalias !53 
      136:  %3 = icmp eq i64 %_5.sroa.5.0._5.sroa.5.0._5.sroa.5.0._5.sroa.5.8._5.i.i.i.i1.i.i, 0 
      137:  br i1 %3, label %"_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h96d9884df458f7e6E.exit", label %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i.i" 
      138:  
      139: "_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i.i": ; preds = %bb6.i 
      140:  tail call void @__rust_dealloc(ptr noundef nonnull %_5.sroa.0.0.copyload, i64 noundef %_5.sroa.5.0._5.sroa.5.0._5.sroa.5.0._5.sroa.5.8._5.i.i.i.i1.i.i, i64 noundef 1) #8, !noalias !55 
      141:  br label %"_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h96d9884df458f7e6E.exit" 
      142:  
      143: bb2.i: ; preds = %bb2 
      144:  %4 = lshr i64 %_5.sroa.5.8._5.sroa.5.8._5.sroa.5.8._5.sroa.5.16._3.i, 8 
      145:  %5 = trunc i64 %4 to i8 
      146:  %_5.sroa.5.0._5.sroa.5.0._5.sroa.5.0._5.sroa.5.8._4.sroa.9.8.copyload8 = load i8, ptr %_5.sroa.5, align 8, !alias.scope !56 
      147:  %_5.sroa.5.1.sroa_idx = getelementptr inbounds i8, ptr %_5.sroa.5, i64 1 
      148:  %_5.sroa.5.1._5.sroa.5.1._5.sroa.5.1._5.sroa.5.9._4.sroa.10.8.copyload9 = load i64, ptr %_5.sroa.5.1.sroa_idx, align 1, !alias.scope !56 
      149:  %6 = getelementptr inbounds i8, ptr %a, i64 18 
      150:  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %_5.sroa.5) 
      151:  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %e.i), !noalias !57 
      152:  store ptr %_5.sroa.0.0.copyload, ptr %e.i, align 8, !noalias !61 
      153:  %_4.sroa.9.8.e.i.sroa_idx = getelementptr inbounds i8, ptr %e.i, i64 8 
      154:  store i8 %_5.sroa.5.0._5.sroa.5.0._5.sroa.5.0._5.sroa.5.8._4.sroa.9.8.copyload8, ptr %_4.sroa.9.8.e.i.sroa_idx, align 8, !noalias !61 
      155:  %_4.sroa.10.8.e.i.sroa_idx = getelementptr inbounds i8, ptr %e.i, i64 9 
      156:  store i64 %_5.sroa.5.1._5.sroa.5.1._5.sroa.5.1._5.sroa.5.9._4.sroa.10.8.copyload9, ptr %_4.sroa.10.8.e.i.sroa_idx, align 1, !noalias !61 
      157:  %_4.sroa.11.8.e.i.sroa_idx = getelementptr inbounds i8, ptr %e.i, i64 17 
      158:  store i8 %5, ptr %_4.sroa.11.8.e.i.sroa_idx, align 1, !noalias !61 
      159:  %_4.sroa.12.8.e.i.sroa_idx = getelementptr inbounds i8, ptr %e.i, i64 18 
      160:  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %_4.sroa.12.8.e.i.sroa_idx, ptr noundef nonnull align 2 dereferenceable(6) %6, i64 6, i1 false) 
      161: ; invoke core::result::unwrap_failed 
not:12                            !~~~~~~~~~~~~  error: no match expected
      162:  invoke void @_ZN4core6result13unwrap_failed17h434e67006fc3a961E(ptr noalias noundef nonnull readonly align 1 @alloc_00ae4b301f7fab8ac9617c03fcbd7274, i64 noundef 43, ptr noundef nonnull align 1 %e.i, ptr noalias noundef nonnull readonly align 8 dereferenceable(32) @vtable.1, ptr noalias noundef nonnull readonly align 8 dereferenceable(24) @alloc_ed8bfa62ecc2b9e2af0bced4759850cb) #9 
      163:  to label %unreachable.i unwind label %cleanup.i, !noalias !57 
      164:  
      165: cleanup.i: ; preds = %bb2.i 
      166:  %7 = landingpad { ptr, i32 } 
      167:  cleanup 
      168:  call void @llvm.experimental.noalias.scope.decl(metadata !62) 
      169:  call void @llvm.experimental.noalias.scope.decl(metadata !65), !noalias !57 
      170:  call void @llvm.experimental.noalias.scope.decl(metadata !68), !noalias !57 
      171:  call void @llvm.experimental.noalias.scope.decl(metadata !71), !noalias !57 
      172:  %_5.i.i.i.i1.i = load i64, ptr %_4.sroa.9.8.e.i.sroa_idx, align 8, !alias.scope !74, !noalias !77 
      173:  %8 = icmp eq i64 %_5.i.i.i.i1.i, 0 
      174:  br i1 %8, label %bb5.i, label %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i" 
      175:  
      176: "_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i": ; preds = %cleanup.i 
      177:  %self3.i.i.i.i3.i = load ptr, ptr %e.i, align 8, !alias.scope !74, !noalias !77, !nonnull !3, !noundef !3 
      178:  call void @__rust_dealloc(ptr noundef nonnull %self3.i.i.i.i3.i, i64 noundef %_5.i.i.i.i1.i, i64 noundef 1) #8, !noalias !79 
      179:  br label %bb5.i 
      180:  
      181: unreachable.i: ; preds = %bb2.i 
      182:  unreachable 
      183:  
      184: bb5.i: ; preds = %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i", %cleanup.i 
      185:  resume { ptr, i32 } %7 
      186:  
      187: "_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h96d9884df458f7e6E.exit": ; preds = %bb6.i, %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i.i" 
      188:  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %_5.sroa.5) 
      189:  %9 = add i8 %_4.sroa.11.1.copyload, %_4.sroa.9.1.copyload 
      190:  br label %bb4 
      191:  
      192: bb1: ; preds = %start 
      193:  tail call void @llvm.experimental.noalias.scope.decl(metadata !80) 
      194:  tail call void @llvm.experimental.noalias.scope.decl(metadata !83) 
      195:  tail call void @llvm.experimental.noalias.scope.decl(metadata !86) 
      196:  tail call void @llvm.experimental.noalias.scope.decl(metadata !89) 
      197:  %10 = getelementptr inbounds i8, ptr %a, i64 8 
      198:  %_5.i.i.i.i1.i2 = load i64, ptr %10, align 8, !alias.scope !92, !noalias !95 
      199:  %11 = icmp eq i64 %_5.i.i.i.i1.i2, 0 
      200:  br i1 %11, label %bb4, label %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i3" 
      201:  
      202: "_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i3": ; preds = %bb1 
      203:  %self3.i.i.i.i3.i4 = load ptr, ptr %a, align 8, !alias.scope !92, !noalias !95, !nonnull !3, !noundef !3 
      204:  tail call void @__rust_dealloc(ptr noundef nonnull %self3.i.i.i.i3.i4, i64 noundef %_5.i.i.i.i1.i2, i64 noundef 1) #8, !noalias !97 
      205:  br label %bb4 
      206:  
      207: bb4: ; preds = %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i3", %bb1, %"_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h96d9884df458f7e6E.exit" 
      208:  %_0.sroa.0.0 = phi i8 [ %9, %"_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h96d9884df458f7e6E.exit" ], [ 0, %bb1 ], [ 0, %"_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hfa1166012eef5c67E.exit.i.i.i2.i3" ] 
      209:  ret i8 %_0.sroa.0.0 
      210: } 
      212: ; core::fmt::Formatter::debug_list 
      212: ; core::fmt::Formatter::debug_list 
      213: ; Function Attrs: nonlazybind uwtable 
      214: declare void @_ZN4core3fmt9Formatter10debug_list17hde3d95a55a067d9dE(ptr dead_on_unwind noalias nocapture noundef writable sret([16 x i8]) align 8 dereferenceable(16), ptr noalias noundef align 8 dereferenceable(64)) unnamed_addr #0 
      216: ; core::fmt::builders::DebugList::finish 
      216: ; core::fmt::builders::DebugList::finish 
      217: ; Function Attrs: nonlazybind uwtable 
      218: declare noundef zeroext i1 @_ZN4core3fmt8builders9DebugList6finish17h5240307549155e39E(ptr noalias noundef align 8 dereferenceable(16)) unnamed_addr #0 
      219:  
      220: ; core::fmt::num::imp::<impl core::fmt::Display for u8>::fmt 
      221: ; Function Attrs: nonlazybind uwtable 
      222: declare noundef zeroext i1 @"_ZN4core3fmt3num3imp51_$LT$impl$u20$core..fmt..Display$u20$for$u20$u8$GT$3fmt17h5925c53d32a1d1b0E"(ptr noalias noundef readonly align 1 dereferenceable(1), ptr noalias noundef align 8 dereferenceable(64)) unnamed_addr #0 
      223:  
      224: ; core::fmt::num::<impl core::fmt::UpperHex for u8>::fmt 
      225: ; Function Attrs: nonlazybind uwtable 
      226: declare noundef zeroext i1 @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..UpperHex$u20$for$u20$u8$GT$3fmt17h749693142f184537E"(ptr noalias noundef readonly align 1 dereferenceable(1), ptr noalias noundef align 8 dereferenceable(64)) unnamed_addr #0 
      227:  
      228: ; core::fmt::num::<impl core::fmt::LowerHex for u8>::fmt 
      229: ; Function Attrs: nonlazybind uwtable 
      230: declare noundef zeroext i1 @"_ZN4core3fmt3num52_$LT$impl$u20$core..fmt..LowerHex$u20$for$u20$u8$GT$3fmt17h6a984048f9983b37E"(ptr noalias noundef readonly align 1 dereferenceable(1), ptr noalias noundef align 8 dereferenceable(64)) unnamed_addr #0 
      231:  
      232: ; Function Attrs: nounwind nonlazybind uwtable 
      233: declare noundef range(i32 0, 10) i32 @rust_eh_personality(i32 noundef, i32 noundef range(i32 1, 17), i64 noundef, ptr noundef, ptr noundef) unnamed_addr #1 
      235: ; core::fmt::builders::DebugList::entry 
      235: ; core::fmt::builders::DebugList::entry 
      236: ; Function Attrs: nonlazybind uwtable 
      237: declare noundef align 8 dereferenceable(16) ptr @_ZN4core3fmt8builders9DebugList5entry17h75b8b82a9fc5be91E(ptr noalias noundef align 8 dereferenceable(16), ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32)) unnamed_addr #0 
      238:  
      239: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 
      240: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2 
      242: ; core::result::unwrap_failed 
      242: ; core::result::unwrap_failed 
      243: ; Function Attrs: cold noinline noreturn nonlazybind uwtable 
      244: declare void @_ZN4core6result13unwrap_failed17h434e67006fc3a961E(ptr noalias noundef nonnull readonly align 1, i64 noundef, ptr noundef nonnull align 1, ptr noalias noundef readonly align 8 dereferenceable(32), ptr noalias noundef readonly align 8 dereferenceable(24)) unnamed_addr #3 
      245:  
      246: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
      247: declare void @llvm.assume(i1 noundef) #4 
      248:  
      249: ; Function Attrs: nounwind nonlazybind allockind("free") uwtable 
      250: declare void @__rust_dealloc(ptr allocptr noundef, i64 noundef, i64 noundef) unnamed_addr #5 
      251:  
      252: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 
      253: declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #6 
      254:  
      255: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 
      256: declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #6 
      257:  
      258: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) 
      259: declare void @llvm.experimental.noalias.scope.decl(metadata) #7 
      260:  
      261: attributes #0 = { nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
        .
        .
>>>>>>
------------------------------------------

@bors
Copy link
Contributor

bors commented Sep 23, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 23, 2024
@DianQK
Copy link
Member Author

DianQK commented Sep 23, 2024

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 23, 2024
@bors
Copy link
Contributor

bors commented Sep 23, 2024

⌛ Testing commit e3a9eaf with merge a772336...

@bors
Copy link
Contributor

bors commented Sep 23, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing a772336 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 23, 2024
@bors bors merged commit a772336 into rust-lang:master Sep 23, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 23, 2024
@DianQK DianQK deleted the early_otherwise_branch_scalar branch September 23, 2024 10:56
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a772336): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.7%, 0.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.5%, 0.7%] 2

Max RSS (memory usage)

Results (primary 5.0%, secondary 3.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.0% [3.9%, 6.8%] 3
Regressions ❌
(secondary)
3.7% [0.8%, 6.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 5.0% [3.9%, 6.8%] 3

Cycles

Results (primary -0.5%, secondary -8.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.5%, -0.4%] 3
Improvements ✅
(secondary)
-8.0% [-8.0%, -8.0%] 1
All ❌✅ (primary) -0.5% [-0.5%, -0.4%] 3

Binary size

Results (primary 0.2%, secondary 0.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 0.8%] 3
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-0.1%, 0.8%] 5

Bootstrap: 768.601s -> 767.14s (-0.19%)
Artifact size: 341.54 MiB -> 341.53 MiB (-0.00%)

jieyouxu added a commit to jieyouxu/rust that referenced this pull request Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
DianQK added a commit to DianQK/rust that referenced this pull request Sep 24, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 25, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value #129047"

This reverts PR #129047, commit a772336fb3fbd1fe4493077fcfe04e0221296a99, reversing changes made to 702987f75b74f789ba227ee04a3d7bb1680c2309.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of #129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value #129047](rust-lang/rust#129047) may have lead to several nightly regressions:

- rust-lang/rust#130769
- rust-lang/rust#130774
- rust-lang/rust#130771

Example test that would ICE with changes in #129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
DianQK added a commit to DianQK/rust that referenced this pull request Oct 30, 2024
DianQK added a commit to DianQK/rust that referenced this pull request Nov 27, 2024
DianQK added a commit to DianQK/rust that referenced this pull request Dec 18, 2024
DiuDiu777 pushed a commit to DiuDiu777/rust that referenced this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants