[llvm] 9203063 - [WebAssembly][TableGen][NFCI] Use getValueAsBit rather than converting TableGen 'bit' to string

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 10:50:12 PDT 2022


Author: Alex Bradbury
Date: 2022-05-16T18:49:48+01:00
New Revision: 92030635318d615f72cd0cd539e458f9cdd9949b

URL: https://github.com/llvm/llvm-project/commit/92030635318d615f72cd0cd539e458f9cdd9949b
DIFF: https://github.com/llvm/llvm-project/commit/92030635318d615f72cd0cd539e458f9cdd9949b.diff

LOG: [WebAssembly][TableGen][NFCI] Use getValueAsBit rather than converting TableGen 'bit' to string

The logic around IsCanonical previously used getAsString and compared to
"1". Just using getValueAsBit is simpler.

Added: 
    

Modified: 
    llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp b/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
index ee7e49cbfce2..d03b1d2e9c9f 100644
--- a/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
+++ b/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
@@ -67,14 +67,11 @@ void emitWebAssemblyDisassemblerTables(
       // should be the canonical one. This determines which variant gets
       // printed in a disassembly. We want e.g. "call" not "i32.call", and
       // "end" when we don't know if its "end_loop" or "end_block" etc.
-      auto IsCanonicalExisting = CGIP.second->TheDef->getValue("IsCanonical")
-                                     ->getValue()
-                                     ->getAsString() == "1";
+      bool IsCanonicalExisting = CGIP.second->TheDef->getValueAsBit("IsCanonical");
       // We already have one marked explicitly as canonical, so keep it.
       if (IsCanonicalExisting)
         continue;
-      auto IsCanonicalNew =
-          Def.getValue("IsCanonical")->getValue()->getAsString() == "1";
+      bool IsCanonicalNew = Def.getValueAsBit("IsCanonical");
       // If the new one is explicitly marked as canonical, take it.
       if (!IsCanonicalNew) {
         // Neither the existing or new instruction is canonical.


        


More information about the llvm-commits mailing list