Encode alignment in MO_Memcpy and friends
ClosedPublic

Authored by bgamari on Jan 20 2015, 11:19 PM.

Details

Summary

Alignment needs to be a compile-time constant. Previously the code
generators had to jump through hoops to ensure this was the case as the
alignment was passed as a CmmExpr in the arguments list. Now we take
care of this up front.

This fixes Trac #8131.

Authored-by: Reid Barton <rwbarton@gmail.com>
Dusted-off-by: Ben Gamari <ben@smart-cactus.org>

Tests for T8131

Test Plan

Validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari updated this revision to Diff 2148.Jan 20 2015, 11:19 PM
bgamari retitled this revision from to Encode alignment in MO_Memcpy and friends.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari added reviewers: rwbarton, austin.
bgamari updated the Trac tickets for this revision.

This a rebasing of @rwbarton's two patches for T8131 which is at this point the only failing test with LLVM 3.6 and D530.

rwbarton edited edge metadata.Jan 21 2015, 10:25 PM

Harbormaster doesn't have LLVM installed, I assume you have tested this locally?

bgamari added a comment.EditedJan 21 2015, 10:29 PM

Yes, this was tested while I was testing D530.

bgamari added a comment.EditedJan 22 2015, 10:58 AM

Unfortunately this fails while bootstrapping GHC due to trivial alignment expressions produced in PrimOps.cmm (namely the WDS macro; e.g. 4 * 1). Not entirely sure of the right way to deal with this; clearly we don't want to perform constant expression evaluation in the parser.

bgamari updated this revision to Diff 2153.Jan 22 2015, 11:32 AM
bgamari edited edge metadata.
  • Encode alignment in MO_Memcpy and friends
  • Eliminate non-constant alignments from RTS and tests
  • Tests for T8131

I've added a fix for the PrimOps issue. Thankfully all of the uses of WDS were WDS(1), which is simply WORD_SZ. Unfortunately the validation failures are seemingly unrelated to the patch and not terribly reproducible. Need to investigate.

austin accepted this revision.Mar 1 2015, 1:23 PM
austin edited edge metadata.

OK, LGTM after a quick pass. Sorry for the review delay!

@rwbarton, do you want to take a glance?

This revision is now accepted and ready to land.Mar 1 2015, 1:23 PM
carter added a subscriber: carter.Mar 8 2015, 12:16 PM
carter added inline comments.
compiler/nativeGen/SPARC/CodeGen.hs
408

is this a description of what the code does, OR a "fix me" note?

rwbarton accepted this revision.Mar 8 2015, 12:33 PM
rwbarton edited edge metadata.

I see, all the includes/Cmm.h and rts/PrimOps.cmm changes are in new uses of prim %memcpy. LGTM.

austin updated this object.Mar 8 2015, 1:22 PM
austin edited edge metadata.
bgamari added inline comments.Jun 5 2015, 4:15 AM
compiler/nativeGen/SPARC/CodeGen.hs
408

I believe this describes the code's function although I didn't write this comment.

bgamari updated this revision to Diff 3245.Jun 15 2015, 7:40 AM
  • Fix build errors
  • CmmParse: Force alignment to ensure that non-constant error fires
bgamari updated this revision to Diff 3249.Jun 15 2015, 9:23 AM

Fix diff

arc previously took the diff against HEAD^.

bgamari updated this revision to Diff 3251.Jun 15 2015, 11:19 AM
  • Fix test
bgamari updated this revision to Diff 3263.Jun 16 2015, 10:09 AM
  • Fix test name
This revision was automatically updated to reflect the committed changes.