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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 13:31:12 PDT 2018


Does this currently affect all shipping versions of msvc? How come I’ve
never encountered it? Am i not running this test?
On Tue, Jul 24, 2018 at 1:18 PM Stella Stamenova via Phabricator <
reviews at reviews.llvm.org> wrote:

> stella.stamenova created this revision.
> stella.stamenova added reviewers: asmith, labath, zturner.
> Herald added subscribers: llvm-commits, JDevlieghere, aprantl.
>
> The VS compiler (on Windows) has a bug which results in
> fieldFromInstruction being optimized out in some circumstances. This only
> happens in *release no debug info* builds that have assertions *turned off*
> - in all other situations the function is not inlined, so the functionality
> is correct. All of the bots have assertions turned on, so this path is not
> regularly tested. The workaround is to not inline the function on Windows -
> if the bug is fixed in a later release of the VS compiler, the noinline
> specification can be removed.
>
> The test that consistently reproduces this is Lanai v11.txt test.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D49753
>
> Files:
>   utils/TableGen/FixedLenDecoderEmitter.cpp
>
>
> Index: utils/TableGen/FixedLenDecoderEmitter.cpp
> ===================================================================
> --- utils/TableGen/FixedLenDecoderEmitter.cpp
> +++ utils/TableGen/FixedLenDecoderEmitter.cpp
> @@ -2066,7 +2066,10 @@
>  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)\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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180724/93bcf0b9/attachment.html>


More information about the llvm-commits mailing list