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

Permit the MIR inliner to inline diverging functions #106428

Merged
merged 6 commits into from
Mar 26, 2023

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Jan 3, 2023

This heuristic prevents inlining of hint::unreachable_unchecked, which in turn makes Option/Result::unwrap_unchecked a bad inlining candidate. I looked through the changes to core, alloc, std, and hashbrown by hand and they all seem reasonable. Let's see how this looks in perf...


Based on rustc-perf it looks like this regresses ctfe-stress, and the cachegrind diff indicates that this regression is in InterpCx::statement. I don't know how to do any deeper analysis because that function is enormous in the try toolchain, which has no debuginfo in it. And a local build produces significantly different codegen for that function, even with LTO.

@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 Jan 3, 2023
@saethlin
Copy link
Member Author

saethlin commented Jan 3, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 3, 2023
@bors
Copy link
Contributor

bors commented Jan 3, 2023

⌛ Trying commit e4ddc8a0f6cac4ea10db08d70f4d15cfd3a5ecaf with merge 696235b229d3d1166bd68a49240f1d7880b2ff2d...

@bors
Copy link
Contributor

bors commented Jan 4, 2023

☀️ Try build successful - checks-actions
Build commit: 696235b229d3d1166bd68a49240f1d7880b2ff2d (696235b229d3d1166bd68a49240f1d7880b2ff2d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (696235b229d3d1166bd68a49240f1d7880b2ff2d): comparison URL.

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

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -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
Regressions ❌
(secondary)
0.8% [0.8%, 0.9%] 3
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 1

Max RSS (memory usage)

Results

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.8% [5.8%, 5.8%] 1
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.9% [-0.1%, 5.8%] 2

Cycles

Results

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)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 4, 2023
@nikic
Copy link
Contributor

nikic commented Jan 4, 2023

This will fail a codegen test. It looks like invert a test condition and turn an llvm.assume into a select with undef. I don't understand enough to be sure if that's good or bad.

Which codegen test is this?

@saethlin
Copy link
Member Author

saethlin commented Jan 4, 2023

This function in particular:

pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 {

@nikic
Copy link
Contributor

nikic commented Jan 4, 2023

This function in particular:

pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 {

Do you happen to have the error log (or new output) for that one?

Strange, the codegen test fails locally but not in CI.

Can at least answer that one: This is a min-llvm-version: 15.0 test, and PR CI runs with LLVM 13.

@saethlin
Copy link
Member Author

saethlin commented Jan 4, 2023

Ah, found the file: unchecked_shifts.txt

running 396 tests
iiiiii.........i....................i...............................i................... 88/396
i...........i...i...................i...........................ii...................... 176/396
i..ii...i.......ii...i.ii.i................ii........................................... 264/396
.....i....i....i..............................................i....i.................... 352/396
................F...........................
failures:

---- [codegen] src/test/codegen/unchecked_shifts.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/home/ben/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll" "/home/ben/rust/src/test/codegen/unchecked_shifts.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/home/ben/rust/src/test/codegen/unchecked_shifts.rs:23:16: error: CHECK-DAG: expected string not found in input
 // CHECK-DAG: %[[INRANGE:. ]] = icmp ult i32 %b, 65536
               ^
/home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll:14:43: note: scanning from here
define i16 @unchecked_shl_unsigned_smaller(i16 %a, i32 %b) unnamed_addr #0 {
                                          ^
/home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll:16:5: note: possible intended match here
 %_2.i.i = icmp ugt i32 %b, 65535
    ^
/home/ben/rust/src/test/codegen/unchecked_shifts.rs:53:16: error: CHECK-DAG: expected string not found in input
 // CHECK-DAG: %[[INRANGE:. ]] = icmp ult i32 %b, 32768
               ^
/home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll:39:41: note: scanning from here
define i16 @unchecked_shr_signed_smaller(i16 %a, i32 %b) unnamed_addr #0 {
                                        ^
/home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll:41:5: note: possible intended match here
 %_2.i.i = icmp ugt i32 %b, 32767
    ^

Input file: /home/ben/rust/build/x86_64-unknown-linux-gnu/test/codegen/unchecked_shifts/unchecked_shifts.ll
Check file: /home/ben/rust/src/test/codegen/unchecked_shifts.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1: ; ModuleID = 'unchecked_shifts.d7deabc1-cgu.0' 
          2: source_filename = "unchecked_shifts.d7deabc1-cgu.0" 
          3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 
          4: target triple = "x86_64-unknown-linux-gnu" 
          5:  
          6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
          7: define i32 @unchecked_shl_unsigned_same(i32 %a, i32 %b) unnamed_addr #0 { 
          8: start: 
          9:  %0 = shl i32 %a, %b 
         10:  ret i32 %0 
         11: } 
         12:  
         13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
         14: define i16 @unchecked_shl_unsigned_smaller(i16 %a, i32 %b) unnamed_addr #0 { 
dag:23'0                                               X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
         15: start: 
dag:23'0     ~~~~~~~
         16:  %_2.i.i = icmp ugt i32 %b, 65535 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dag:23'1         ?                              possible intended match
         17:  %_5.i.i = trunc i32 %b to i16 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         18:  %.sroa.3.0.i.i = select i1 %_2.i.i, i16 undef, i16 %_5.i.i 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         19:  %0 = shl i16 %a, %.sroa.3.0.i.i 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         20:  ret i16 %0 
dag:23'0     ~~~~~~~~~~~~
         21: } 
dag:23'0     ~~
         22:  
dag:23'0     ~
         23: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         24: define i64 @unchecked_shl_unsigned_bigger(i64 %a, i32 %b) unnamed_addr #0 { 
dag:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         25: start: 
         26:  %0 = zext i32 %b to i64 
         27:  %1 = shl i64 %a, %0 
         28:  ret i64 %1 
         29: } 
         30:  
         31: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
         32: define i32 @unchecked_shr_signed_same(i32 %a, i32 %b) unnamed_addr #0 { 
         33: start: 
         34:  %0 = ashr i32 %a, %b 
         35:  ret i32 %0 
         36: } 
         37:  
         38: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
         39: define i16 @unchecked_shr_signed_smaller(i16 %a, i32 %b) unnamed_addr #0 { 
dag:53'0                                             X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
         40: start: 
dag:53'0     ~~~~~~~
         41:  %_2.i.i = icmp ugt i32 %b, 32767 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dag:53'1         ?                              possible intended match
         42:  %_5.i.i = trunc i32 %b to i16 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         43:  %.sroa.3.0.i.i = select i1 %_2.i.i, i16 undef, i16 %_5.i.i 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         44:  %0 = ashr i16 %a, %.sroa.3.0.i.i 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         45:  ret i16 %0 
dag:53'0     ~~~~~~~~~~~~
         46: } 
dag:53'0     ~~
         47:  
dag:53'0     ~
         48: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         49: define i64 @unchecked_shr_signed_bigger(i64 %a, i32 %b) unnamed_addr #0 { 
dag:53'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         50: start: 
         51:  %0 = zext i32 %b to i64 
         52:  %1 = ashr i64 %a, %0 
         53:  ret i64 %1 
         54: } 
         55:  
         56: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind readnone willreturn uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } 
         57:  
         58: !llvm.module.flags = !{!0, !1} 
         59:  
         60: !0 = !{i32 7, !"PIC Level", i32 2} 
         61: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
>>>>>>
------------------------------------------



failures:
    [codegen] src/test/codegen/unchecked_shifts.rs

test result: FAILED. 363 passed; 1 failed; 32 ignored; 0 measured; 0 filtered out; finished in 2.37s

Some tests failed in compiletest suite=codegen mode=codegen host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu

@nikic
Copy link
Contributor

nikic commented Jan 4, 2023

Thanks! The weird select should get fixed by #106294, so maybe wait for that one to land.

That'll still loose the assume, but I'm not sure we care about it (I think @scottmcm wanted to have these?)

@scottmcm
Copy link
Member

scottmcm commented Jan 7, 2023

@nikic I think that select is actually important, because it's preserving the UB for a too-large shift (as it makes 0_u16.unchecked_shift(0x100) end up doing ashr i16 0, undef, which is UB because out-of-bounds shifts are UB, and the undef cold be out-of-bounds).

I don't have a strong opinion on how the LLVM-level UB-ness for that is preserved, just that it's still there. If it ending up producing a select like that is a good way to keep it for later LLVM optimizations (instead of the assume) and it doesn't affect codegen, then great.

But I'm slightly concerned that this means that everthing using unreachable_unchecked might be impacted by this in surprising ways. Why does MIR-level inlining it -- unchecked_shr uses it via unwrap_unchecked, IIRC -- mean that the LLVM codegen is changing? That seems surprising, and potentially concerning.

Would it perhaps be worth a mir-transform test that unwrap_unchecked is still doing what we'd expect after this?

EDIT: Oh, wait, out-of-bounds shift is poison, not UB, whereas llvm.assume(false) is UB. But I guess that's fine?


Aside: reason number 2947643 that I want trunc nuw to represent this stuff directly rather than needing tricky undefs and assumes...

@saethlin saethlin force-pushed the inline-diverging-functions branch 2 times, most recently from 9fd6e31 to 0dd6e02 Compare January 17, 2023 22:18
@saethlin
Copy link
Member Author

I've rebased this up since #106294 is now merged.

By default, the llvm.assume call goes away. But the MIR has a form I've long been suspicious of: There are two blocks which are only unreachable. It turns out turning on the MIR pass DeduplicateBlocks, which will delete one of these, fixes the LLVM regression. 🤔

@saethlin
Copy link
Member Author

saethlin commented Jan 18, 2023

I could have sworn we ensure that we emit one unreachable block per function in rustc_codegen_ssa. So that pass shouldn't matter actually. But it seems like it does.

Turning off MIR inlining also causes the llvm.assume calls to disappear. So it seems like we need to do just the right amount of MIR inlining to preserve the llvm.assume? If that's true, this seems very fragile, and possibly an LLVM issue, so I'm not sure if I should even care about this.

@scottmcm
Copy link
Member

Don't block this PR on that one assume. Do whatever you need for that codegen test; I can always update the implementation of unchecked_sh[lr] to be more direct if needed.

Just so long as you're convinced that this additional inlining doesn't regress people using unwrap_unchecked in general. That's the only thing that scares me about the codegen test failure.

@saethlin
Copy link
Member Author

saethlin commented Jan 20, 2023

Just so long as you're convinced that this additional inlining doesn't regress people using unwrap_unchecked in general. That's the only thing that scares me about the codegen test failure.

I looked for examples of other codegen in the standard library which depends on unwrap_unchecked and haven't been able to find any good ones. There is some use of it, but it's mostly buried inside larger implementations. There is a tantalizing use in Option::insert, but that can be replaced with just .unwrap() without altering codegen.

I'm going to try hunting for examples in the ecosystem.

@rust-log-analyzer

This comment has been minimized.

_2 = move _1; // scope 0 at $DIR/unwrap_unchecked.rs: 1:5: 1:8
StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs: 1:9: 1:27
_4 = discriminant(_2); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all other targets are unreachable, we could InstCombine this pattern into:

_5 = Eq(_4, const 1_size);
Assume(_5);
goto -> bb3

Would this help LLVM ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My instinct is that we should keep the "otherwise unreachable" part so LLVM knows that _4 is definitely 1, and can optimize backwards using that.

Thus perhaps something like

Suggested change
switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
switchInt(move _4) -> [1: bb3, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL

might be best?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that transformation is accomplished by DeduplicateBlocks, which I noted back here: #106428 (comment) though I'll admit I was a bit vague.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeduplicateBlocks can be a heavy hammer, since it hashes basic blocks. Detecting unreachable blocks is trivial, since we only need to test the terminator. That's why I suggested modifying InstCombine. SimplifyCfg could do the trick too.
About the final solution: either the assume or the reduced SwitchInt, I don't mind, as long as LLVM understands.

@cjgillot cjgillot added the A-mir-opt Area: MIR optimizations label Jan 21, 2023
@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@bors
Copy link
Contributor

bors commented Mar 26, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 26, 2023
@bors bors merged commit 2420bd3 into rust-lang:master Mar 26, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 26, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2420bd3): 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.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.4%, 0.6%] 2

Max RSS (memory usage)

Results

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)
1.5% [0.4%, 6.2%] 40
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.2% [-5.7%, -0.1%] 4
Improvements ✅
(secondary)
-4.7% [-4.7%, -4.7%] 1
All ❌✅ (primary) 1.1% [-5.7%, 6.2%] 44

Cycles

This benchmark run did not return any relevant results for this metric.

@rustbot rustbot removed the perf-regression Performance regression. label Mar 26, 2023
@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-apple-alt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling sysinfo v0.26.7
error: could not compile `bootstrap`

Caused by:
  process didn't exit successfully: `/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0/bin/rustc --crate-name bootstrap --edition=2021 lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=1 --cfg 'feature="build-metrics"' --cfg 'feature="sysinfo"' -C metadata=ce3210034294b420 -C extra-filename=-ce3210034294b420 --out-dir /Users/runner/work/rust/rust/build/bootstrap/debug/deps -C incremental=/Users/runner/work/rust/rust/build/bootstrap/debug/incremental -L dependency=/Users/runner/work/rust/rust/build/bootstrap/debug/deps --extern atty=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libatty-f3463e585de1f047.rmeta --extern build_helper=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libbuild_helper-9d2bc277721db64f.rmeta --extern cc=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libcc-49bfe8c7d867fb37.rmeta --extern cmake=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libcmake-89997d098798ab5e.rmeta --extern fd_lock=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libfd_lock-d352b88169ae9b78.rmeta --extern filetime=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libfiletime-dfad8c62ded938a8.rmeta --extern getopts=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libgetopts-919ee0a0aa1476b8.rmeta --extern hex=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libhex-236ab3c1bfe4e4f1.rmeta --extern ignore=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libignore-a7771d5b7aea3d15.rmeta --extern libc=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/liblibc-44c5b86cce046821.rmeta --extern object=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libobject-311d048112783467.rmeta --extern once_cell=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libonce_cell-fb2de34fe0557dc6.rmeta --extern opener=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libopener-0eab13e0ca8f31ca.rmeta --extern serde=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libserde-d05a262813607a2d.rmeta --extern serde_derive=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libserde_derive-2aab301c883d1ded.dylib --extern serde_json=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libserde_json-0a148363995afa96.rmeta --extern sha2=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libsha2-7b55139cb79fb0aa.rmeta --extern sysinfo=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libsysinfo-c6ae361f7ec35ee4.rlib --extern tar=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libtar-8a82ba23634473a9.rmeta --extern termcolor=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libtermcolor-799832683ef6fe02.rmeta --extern toml=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libtoml-e06787ff05533496.rmeta --extern walkdir=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libwalkdir-d7f1d54c877394c7.rmeta --extern xz2=/Users/runner/work/rust/rust/build/bootstrap/debug/deps/libxz2-a46d8b83251c0877.rmeta -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -L native=/usr/local/Cellar/xz/5.4.1/lib` (signal: 11, SIGSEGV: invalid memory reference)
Build completed unsuccessfully in 0:01:13
make: *** [prepare] Error 1
Command failed. Attempt 2/5:
Building bootstrap
---
[ 17%] Building X86GenDisassemblerTables.inc...
[ 17%] Building RISCVGenSearchableTables.inc...
[ 17%] Building AVRGenInstrInfo.inc...
[ 17%] Building RISCVGenSubtargetInfo.inc...
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ../../../bin/llvm-tblgen -gen-callingconv -I /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target/X86 -I/Users/runner/work/rust/rust/build/x86_64-apple-darwin/llvm/build/include -I/Users/runner/work/rust/rust/src/llvm-project/llvm/include -I /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target -no-warn-on-unused-template-args /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target/X86/X86.td --write-if-changed -o /Users/runner/work/rust/rust/build/x86_64-apple-darwin/llvm/build/lib/Target/X86/X86GenCallingConv.inc
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  llvm-tblgen              0x000000010e6bfafb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)   43
1  llvm-tblgen              0x000000010e6bebb8 llvm::sys::RunSignalHandlers()   248
2  llvm-tblgen              0x000000010e6c0160 SignalHandler(int)   288
3  libsystem_platform.dylib 0x00007ff817820dfd _sigtramp   29
4  llvm-tblgen              0x000000010e6a3a10 llvm::StringMapImpl::LookupBucketFor(llvm::StringRef)   592
5  libsystem_c.dylib        0x00007ff817756d24 abort   123
6  libsystem_malloc.dylib   0x00007ff817634357 has_default_zone0   0
7  libsystem_malloc.dylib   0x00007ff81763752b malloc_report   151
8  llvm-tblgen              0x000000010e4e04d9 llvm::Record::~Record()   121
9  llvm-tblgen              0x000000010e6e165f std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   63
10 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
11 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
12 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
13 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
14 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
15 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
16 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
17 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
18 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
19 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
20 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
21 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
22 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
23 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
[ 17%] Building AVRGenMCCodeEmitter.inc...
24 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
25 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
26 llvm-tblgen              0x000000010e6e1646 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   38
27 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
28 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
29 llvm-tblgen              0x000000010e6e163a std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, std::__1::less<void>, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>>, void*>*)   26
30 llvm-tblgen              0x000000010e6d9f5e llvm::RecordKeeper::~RecordKeeper()   190
31 llvm-tblgen              0x000000010e6c6e1e llvm::TableGenMain(char const*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&))   3614
32 llvm-tblgen              0x000000010e65ff49 main   137
33 llvm-tblgen              0x000000010e4311b4 start   52
34 llvm-tblgen              0x000000000000000d start   18446744069175307917
/bin/sh: line 1: 73629 Abort trap: 6           ../../../bin/llvm-tblgen -gen-callingconv -I /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target/X86 -I/Users/runner/work/rust/rust/build/x86_64-apple-darwin/llvm/build/include -I/Users/runner/work/rust/rust/src/llvm-project/llvm/include -I /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target -no-warn-on-unused-template-args /Users/runner/work/rust/rust/src/llvm-project/llvm/lib/Target/X86/X86.td --write-if-changed -o /Users/runner/work/rust/rust/build/x86_64-apple-darwin/llvm/build/lib/Target/X86/X86GenCallingConv.inc
make[2]: *** [lib/Target/X86/X86GenCallingConv.inc] Error 134
make[2]: *** Deleting file `lib/Target/X86/X86GenCallingConv.inc'
make[2]: *** Waiting for unfinished jobs....
[ 17%] Building AVRGenRegisterInfo.inc...
[ 17%] Building AVRGenSubtargetInfo.inc...
[ 17%] Building M68kGenRegisterInfo.inc...
[ 17%] Building M68kGenRegisterBank.inc...
---
[ 23%] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/MCSection.cpp.o
[ 23%] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/MCSectionCOFF.cpp.o
[ 23%] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/DiagnosticPrinter.cpp.o
[ 23%] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/MCSectionDXContainer.cpp.o
make[1]: *** [lib/Target/X86/CMakeFiles/X86CommonTableGen.dir/all] Error 2
[ 23%] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Dominators.cpp.o
make[1]: *** Waiting for unfinished jobs....
[ 23%] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/FPEnv.cpp.o
[ 23%] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Function.cpp.o
[ 23%] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/GCStrategy.cpp.o
[ 23%] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/MCSectionMachO.cpp.o
---
make: *** [all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit status: 2

build script failed, must exit now', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.48/src/lib.rs:975:5
 finished in 132.192 seconds
Build completed unsuccessfully in 0:05:01

@saethlin saethlin deleted the inline-diverging-functions branch April 2, 2023 19:28
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2023
…illot

Deduplicate unreachable blocks, for real this time

In rust-lang#106428 (in particular rust-lang@41eda69) we noticed that inlining `unreachable_unchecked` can produce duplicate unreachable blocks. So we improved two MIR optimizations: `SimplifyCfg` was given a simplify to deduplicate unreachable blocks, then `InstCombine` was given a combiner to deduplicate switch targets that point at the same block. The problem is that change doesn't actually work.

Our current pass order is
```
SimplifyCfg (does nothing relevant to this situation)
Inline (produces multiple unreachable blocks)
InstCombine (doesn't do anything here, oops)
SimplifyCfg (produces the duplicate SwitchTargets that InstCombine is looking for)
```

So in here, I have factored out the specific function from `InstCombine` and placed it inside the simplify that produces the case it is looking for. This should ensure that it runs in the scenario it was designed for.

Fixes rust-lang#110551
r? `@cjgillot`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
Deduplicate unreachable blocks, for real this time

In rust-lang/rust#106428 (in particular rust-lang/rust@41eda69) we noticed that inlining `unreachable_unchecked` can produce duplicate unreachable blocks. So we improved two MIR optimizations: `SimplifyCfg` was given a simplify to deduplicate unreachable blocks, then `InstCombine` was given a combiner to deduplicate switch targets that point at the same block. The problem is that change doesn't actually work.

Our current pass order is
```
SimplifyCfg (does nothing relevant to this situation)
Inline (produces multiple unreachable blocks)
InstCombine (doesn't do anything here, oops)
SimplifyCfg (produces the duplicate SwitchTargets that InstCombine is looking for)
```

So in here, I have factored out the specific function from `InstCombine` and placed it inside the simplify that produces the case it is looking for. This should ensure that it runs in the scenario it was designed for.

Fixes rust-lang/rust#110551
r? `@cjgillot`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Deduplicate unreachable blocks, for real this time

In rust-lang/rust#106428 (in particular rust-lang/rust@41eda69) we noticed that inlining `unreachable_unchecked` can produce duplicate unreachable blocks. So we improved two MIR optimizations: `SimplifyCfg` was given a simplify to deduplicate unreachable blocks, then `InstCombine` was given a combiner to deduplicate switch targets that point at the same block. The problem is that change doesn't actually work.

Our current pass order is
```
SimplifyCfg (does nothing relevant to this situation)
Inline (produces multiple unreachable blocks)
InstCombine (doesn't do anything here, oops)
SimplifyCfg (produces the duplicate SwitchTargets that InstCombine is looking for)
```

So in here, I have factored out the specific function from `InstCombine` and placed it inside the simplify that produces the case it is looking for. This should ensure that it runs in the scenario it was designed for.

Fixes rust-lang/rust#110551
r? `@cjgillot`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.