[PATCH] D63633: [WebAssembly] Fix p2align in assembler.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 11:23:22 PDT 2019


sbc100 added a comment.

Nice!



================
Comment at: lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp:716
+        auto &Op0 = Inst.getOperand(0);
+        if (Op0.getImm() == -1) Op0.setImm(Align);
+      }
----------------
Does llvm style allow this?  clang-format?

Is there some way we can tell if an opcode requires alignment?   Calling GetDefaultP2AlignAny and checking for -1 seems bit hacky.   Assuming I understand what happing I think this code would be more readable as:

```
if (requiresAlignment() && !hasAlignment) {
  setImm(getDefaultAlign())
}
```


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63633/new/

https://reviews.llvm.org/D63633





More information about the llvm-commits mailing list