You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I have figured out what happened here (mostly) and it's pretty hilarious. For those who care here's the story...
The key fact here is that there a few calls to begin_unwind, and all of these that the string explicit panic. Usually LLVM recognizes this and specializes begin_unwind to have that value inline instead of getting it as an argument.
This means that the call to begin_unwind is very cheap, only the line number needs to be loaded into a register. This means that the common code for the calls to begin_unwind are just 2 instructions (a move and a call).
Now, for some reason the added inline attribute tickles LLVM in a bad way and it stops to eliminate the function argument. I don't have an explanation for this(, yet?). Anyway, because the argument is still there, the calls to begin_unwind end up being more expensive (3 moves and a call).
Now, the calls to begin_unwind don't return. So they are block tails. And because the calls are more expensive now, tail merging now kicks in. And tail merging simply can't preserve the debuginfo, so the test has to fail.
Took me quite a while to figure that out. Fun fact: I basically had this figured out before, because tail merging was also the reason why I had to remove a case from that test when I turned fat pointers into immediate function arguments.
Anyway, I'm going to file a PR that adds -Cllvm-args=-enable-tail-merge=0 for this testcase, that should make it less error prone.
Activity
TimNN commentedon Aug 9, 2015
I think this needs to be reopened:
cc #27617, #27612, #27611
TimNN commentedon Aug 10, 2015
I just tried building the master branch locally and it fails with the same error (compiling
i686-unknown-linux-gnuon 64bit ubuntu).TimNN commentedon Aug 10, 2015
Looks like this was introduced in febdc3b (a5d33d8 tests successfully for me) when @arielb1 accidentally pushed to master (see https://botbot.me/mozilla/rust-internals/2015-08-09/?msg=46787325&page=2; because of the minor change the consensus was to leave the commit as is).
Auto merge of #27634 - TimNN:master, r=dotdash
bluss commentedon Aug 10, 2015
I'm sorry that I didn't suggest more caution there, truly surprising breakage. Lesson learned.. everything must pass bors.
barosl commentedon Aug 10, 2015
That's quite intriguing! The one-line change seemed truly innocent to me. Any idea on how the breakage happened?
alexcrichton commentedon Aug 10, 2015
Fixed in #27634
dotdash commentedon Aug 10, 2015
So, I have figured out what happened here (mostly) and it's pretty hilarious. For those who care here's the story...
The key fact here is that there a few calls to
begin_unwind, and all of these that the stringexplicit panic. Usually LLVM recognizes this and specializesbegin_unwindto have that value inline instead of getting it as an argument.This means that the call to
begin_unwindis very cheap, only the line number needs to be loaded into a register. This means that the common code for the calls tobegin_unwindare just 2 instructions (a move and a call).Now, for some reason the added
inlineattribute tickles LLVM in a bad way and it stops to eliminate the function argument. I don't have an explanation for this(, yet?). Anyway, because the argument is still there, the calls tobegin_unwindend up being more expensive (3 moves and a call).Now, the calls to
begin_unwinddon't return. So they are block tails. And because the calls are more expensive now, tail merging now kicks in. And tail merging simply can't preserve the debuginfo, so the test has to fail.Took me quite a while to figure that out. Fun fact: I basically had this figured out before, because tail merging was also the reason why I had to remove a case from that test when I turned fat pointers into immediate function arguments.
Anyway, I'm going to file a PR that adds
-Cllvm-args=-enable-tail-merge=0for this testcase, that should make it less error prone.