[PATCH] D83375: [NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 02:41:01 PDT 2020


gchatelet marked 2 inline comments as done.
gchatelet added a comment.

This patch splits the two implementations, moves a few lines and simplifies the code by inferring constant values.
The semantic is unchanged.



================
Comment at: llvm/include/llvm/Bitcode/LLVMBitCodes.h:539
   FUNC_CODE_INST_FENCE = 36,       // FENCE: [ordering, synchscope]
-  FUNC_CODE_INST_CMPXCHG_OLD = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol,
-                                   //           ordering, synchscope]
+  FUNC_CODE_INST_CMPXCHG_OLD = 37, // CMPXCHG: [ptrty, ptr, cmp, new, vol,
+                                   //           success_ordering, ssid,
----------------
The documentation here was wrong.
alignment was never stored for `FUNC_CODE_INST_CMPXCHG_OLD` and `failure_ordering` and `weak` were optional.


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4989
+      Value *Ptr = nullptr;
+      if (getValueTypePair(Record, Slot, NextValueNo, Ptr, &FullTy))
         return error("Invalid record");
----------------
Each function taking `Slot` (previously `OpNum`) will increase it if successful.
This allows to replace `OpNum + X` by its value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83375





More information about the llvm-commits mailing list