[PATCH] D49753: [windows] Don't inline fieldFromInstruction on Windows

Stella Stamenova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 10:33:38 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337942: [windows] Don't inline fieldFromInstruction on Windows (authored by stella.stamenova, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49753?vs=157147&id=157307#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49753

Files:
  llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp


Index: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
===================================================================
--- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -2063,10 +2063,16 @@
 
 // emitFieldFromInstruction - Emit the templated helper function
 // fieldFromInstruction().
+// On Windows we make sure that this function is not inlined when
+// using the VS compiler. It has a bug which causes the function
+// to be optimized out in some circustances. See llvm.org/pr38292
 static void emitFieldFromInstruction(formatted_raw_ostream &OS) {
   OS << "// Helper function for extracting fields from encoded instructions.\n"
      << "template<typename InsnType>\n"
-   << "static InsnType fieldFromInstruction(InsnType insn, unsigned startBit,\n"
+     << "#if defined(_MSC_VER) && !defined(__clang__)\n"
+     << "__declspec(noinline)\n"
+     << "#endif\n"
+     << "static InsnType fieldFromInstruction(InsnType insn, unsigned startBit,\n"
      << "                                     unsigned numBits) {\n"
      << "    assert(startBit + numBits <= (sizeof(InsnType)*8) &&\n"
      << "           \"Instruction field out of bounds!\");\n"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49753.157307.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180725/ba633b60/attachment.bin>


More information about the llvm-commits mailing list