[PATCH] D43991: [WebAssembly] More uses of uint8_t for single byte values

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 04:36:39 PST 2018

ncw added a comment.

I saw the build failures too, when I was trying to land some patches today. I feel I can't land until the tests pass, even if the failures weren't caused by me.

This commit is causing the function body to change from:

  from: 024041818080800041004180808080001081808080000D000F0B00000B
  to:   02C00041818080800041004180808080001081808080000D000F0B00000B

That corresponds to `block = 0x02 <blocktype>` where `blocktype` has changed from being `0x40` (which was correct) to `0xC000` which is incorrect - and is `-0x40` in SLEB encoding.

There's something fishy in this code even to begin with - the old code had `ExprType::Void = -0x40` when the value to be written out is `+0x40`, and yet `ExprType::I32 = -0x01` was used to write out a value of `+0x7F`. Somehow the encoding was treating void differently!?!

In the new code, it's been changed to `ExprType::Void = +0x40` (corresponding to the byte value that's correct) and `ExprType::I32 = +0x7F` (again the same as the byte that's to be written out).

We could just revert this commit, or maybe spend another half hour trying to understand how on earth the old code was working...



More information about the llvm-commits mailing list