Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSquash of fastcomp commit 4105790f1549808c1f1daa5250b4ada5f41a5c02 #50
Conversation
rust-highfive
assigned
alexcrichton
Sep 6, 2016
This comment has been minimized.
This comment has been minimized.
rust-highfive
commented
Sep 6, 2016
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
rust-highfive
commented
Sep 6, 2016
alexcrichton
reviewed
Sep 6, 2016
| // is quite desirable. | ||
| if (isSplat || newMask == LHSMask || newMask == RHSMask || newMask == Mask || | ||
| true) | ||
| { |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Sep 6, 2016
Member
This seems pretty suspicious in the sense that it's a change made with the assumption that LLVM is only generating asmjs. I wonder if we should back this out?
This comment has been minimized.
This comment has been minimized.
brson
Sep 7, 2016
Author
I've checked with @sunfish and we can revert this with little performance impact on asmjs. I will do so.
alexcrichton
reviewed
Sep 6, 2016
| // @LOCALMOD-BEGIN | ||
| // We don't want to introduce non-power-of-two integer sizes for PNaCl's | ||
| // stable wire format, so modify this transformation for NaCl. | ||
| isPowerOf2_32(TypeBits - Amt) && (TypeBits - Amt) >= 8 && |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Sep 6, 2016
Member
Although this seems suspicious, it also seems like something that we wouldn't hit anyway (we never use e.g. i55) so this appears fine
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kripken
Sep 7, 2016
It looks like code from our pnacl legacy, avoiding weird nonstandard integers (which we don't know how to legalize). I'm not sure of more details, but to be safe, you could condition it on the target being emscripten.
alexcrichton
reviewed
Sep 6, 2016
| if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue)) { | ||
| if (GS.Ordering == AtomicOrdering::NotAtomic) { | ||
| if (TryToShrinkGlobalToBoolean(GV, SOVConstant)) { | ||
| if (TryToAddRangeMetadata(GV, SOVConstant)) { // XXX EMSCRIPTEN |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Sep 6, 2016
Member
I... don't know what's going on here, but... I guess can't be too bad?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kripken
Sep 7, 2016
I think this annoyed us because it turns globals into booleans which ended up adding overhead for us (masking, etc.) on some benchmark. I doubt it makes much different natively. But as in the others, might make sense to condition it on the target being emscripten I guess.
alexcrichton
reviewed
Sep 6, 2016
| @@ -606,10 +606,10 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { | |||
| GV.hasAvailableExternallyLinkage(), | |||
| "Global is marked as dllimport, but not external", &GV); | |||
|
|
|||
| if (!GV.hasInitializer()) { | |||
| //if (!GV.hasInitializer()) { // XXX EMSCRIPTEN - do not do extra verification below, 40x slower linking on some big projects | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Sep 6, 2016
| @@ -336,6 +336,69 @@ void initializeVirtRegMapPass(PassRegistry&); | |||
| void initializeVirtRegRewriterPass(PassRegistry&); | |||
| void initializeWholeProgramDevirtPass(PassRegistry &); | |||
| void initializeWinEHPreparePass(PassRegistry&); | |||
|
|
|||
| // @LOCALMOD-BEGIN | |||
| void initializeAddPNaClExternalDeclsPass(PassRegistry&); | |||
This comment has been minimized.
This comment has been minimized.
alexcrichton
Sep 6, 2016
Member
So just to confirm, we currently believe that these passes will only run for the emscripten target? That is, if we generate x86_64 linux code, these'll all be turned off by default?
This comment has been minimized.
This comment has been minimized.
kripken
Sep 7, 2016
Yes, the only place those initialize* methods are called is in the asmjs backend. They can't affect normal builds.
brson
force-pushed the
brson:fastcomp-squash
branch
from
f19e5a4
to
af0684e
Sep 7, 2016
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton I've added a patch to revert two of the changes and determined that the others should not affect us. |
brson
force-pushed the
brson:fastcomp-squash
branch
from
af0684e
to
8d07d6d
Sep 7, 2016
This comment has been minimized.
This comment has been minimized.
|
Tally ho! |
brson commentedSep 6, 2016
•
edited
This is the entire content of the emscripten fastcomp LLVM fork, which it uses to generate asm.js and which can also be used to generate wasm. By importing this into our tree we can do the same, by emitting LLVM IR that emscripten's emcc compiler understands.
The vast majority of the code here belongs to the pnacl IR legalizer and to the asmjs backend, though there are a few bits that touch common code. As such, I expect this to be relatively easy to maintain, the maintenance model being:
The only reason I expect emscripten to need to upgrade LLVM in the future is to move to the upstream wasm backend, which we will also want. So there is in fact the possibility we will be looking forward to quite a bit of llvm churn in the near future.
Once the LLVM wasm backend is complete we can consider dropping this patch, though at that time will either need to also drop asm.js support or invest considerable effort into a wasm2asmjs code path.
Once this is merged and the libc patches for wasm merged, I will submit a patch to Rust adding more-or-less working asmjs/wasm32 targets.
r? @alexcrichton