codegen: assume constants cannot fail to evaluate#81327
codegen: assume constants cannot fail to evaluate#81327bors merged 1 commit intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
da21fca to
f09ab23
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Argh... there are a whole bunch of basic blocks being created before the codegen context is fully set up, and we really don't care about any of them as we'll exit with a hard error, but some assertion somewhere insists we give them all a terminator... |
f09ab23 to
6d4e03a
Compare
|
@bors r+ |
|
📌 Commit 6d4e03a has been approved by |
|
⌛ Testing commit 6d4e03a with merge 458841964cc08a5f5571285a44545d156a8a6e81... |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test failed - checks-actions |
|
Same as #81375 (comment)... |
|
not sure if this is retryable... I think CI is borked |
|
@oli-obk Looks like some changes in serde make type inference fails. |
|
Yeah, the retry will take place when the tree is reopened. Cc #81378 |
|
Could this be the cause of the MSVC timeouts I'm seeing in #81394, #81437, and #81450? Specifically, this test seems to hang: https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/assoc_const_generic_impl.rs |
|
That test did cause some trouble here, yeah. No idea how it can cause a hang though. |
| for bb in mir.basic_blocks().indices() { | ||
| if bb != mir::START_BLOCK { | ||
| unsafe { | ||
| bx.delete_basic_block(fx.blocks[bb]); |
There was a problem hiding this comment.
FWIW, delete_basic_block is unsafe but I was unable to find documentation for what the safety condition is. Cc @eddyb @nikomatsakis @bjorn3 ; who else could know about this?
There was a problem hiding this comment.
For cg_llvm it calls LLVMDeleteBasicBlock which calls BasicBlock::eraseFromParent which uses vector::erase to remove the basic block, thus invalidating all pointers to it. Other blocks may still reference it, so I don't think this is safe to do.
There was a problem hiding this comment.
What about checking if all constant could be evaluated first before creating any basic blocks?
Edit: I didn't read #81327 (comment). Would it work if you just keep the basic blocks and never fill them?
There was a problem hiding this comment.
Would it work if you just keep the basic blocks and never fill them?
I tried that first. Then I get assertion failures about missing terminators.
Maybe I should somehow add an unreachable terminator to each basic block... this is so silly.^^
There was a problem hiding this comment.
Maybe I should somehow add an unreachable terminator to each basic block
Actually, that does not seem possible. There seems to be no API to switch the build to a different basic block.
There was a problem hiding this comment.
I tried that first. Then I get assertion failures about missing terminators.
Then it probably tries to create an object file even when there were compilation errors before.
There was a problem hiding this comment.
Possible. FWIW, the assertion failures only showed on CI, not locally (so they probably require llvm-debug-assert or so).
|
@bors r- |
6d4e03a to
954808b
Compare
This comment has been minimized.
This comment has been minimized.
|
sigh yet another LLVM assertion... |
|
@bjorn3 nope this doesn't work, it just hangs forever. Potentially that's related to this |
84760f0 to
a1f782e
Compare
|
At least locally, it doesn't hang if I do |
|
I think this is because of the |
|
Isn't it problematic to skip that blocking, and still go on building things? |
|
The blocking is to prevent too much worker threads optimizing the codegen units at once, but because no codegen units are getting optimized anymore when an error has occured, no new worker threads are being spawned either. This means that not blocking when there was an error is fine. |
|
This seems rather fragile; doing For example, we are sill doing Also, if there is some invariant regarding the number of |
also don't submit code to LLVM when the session has errors
a1f782e to
944237f
Compare
|
@bors r+ |
|
📌 Commit 944237f has been approved by |
|
☀️ Test successful - checks-actions |
See rust-lang/rust#81327 for the same change to cg_llvm
#80579 landed, so we can finally remove this old hack from codegen and instead assume that consts never fail to evaluate. :)
r? @oli-obk