SuccessChanges

Summary

  1. [flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC. (details)
  2. [WebAssembly] New-style command support (details)
  3. [flang][msvc] Workaround 'forgotten' symbols in FoldOperation. NFC. (details)
  4. [APFloat] Improve asserts in isSignificandAllOnes and isSignificandAllZeros so they protect shift operations from undefined behavior. (details)
  5. [ELF] --wrap: don't unnecessarily expose __real_ (details)
  6. Revert "[llvm-exegesis] Add option to check the hardware support for a given feature before benchmarking." (details)
Commit b656189e6a602aaf86714ccbf89d94f2ef05b644 by llvm-project
[flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC.

Msvc reports the following error when a ReferenceVariantBase is constructed using an r-value reference or instantiated as std::vector template parameter.  The error message is:
```
PFTBuilder.h(59,1): error C2665: 'std::variant<...>::variant': none of the 2 overloads could convert all the argument types
variant(1248,1): message : could be 'std::variant<...>::variant(std::variant<...> &&) noexcept(false)'
variant(1248,1): message : or       'std::variant<...>::variant(const std::variant<...> &) noexcept(false)'
PFTBuilder.h(59,1): message : while trying to match the argument list '(common::Reference<lower::pft::ReferenceVariantBase<false,...>>)'
```

Work around the ambiguity by only taking `common::Reference` arguments in the constructor. That is, conversion to common::Reference has to be done be the caller instead of being done inside the ctor. Unfortunately, with this change clang/gcc (but not msvc) insist on that the ReferenceVariantBase is stored in a `std::initializer_list`-initialized variable before being used, like being passed to a function or returned.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D88109
The file was modifiedflang/include/flang/Lower/PFTBuilder.h
The file was modifiedflang/lib/Lower/PFTBuilder.cpp
Commit 6cd8511e5932e4a53b2bb7780f69489355fc7783 by Dev
[WebAssembly] New-style command support

This adds support for new-style command support. In this mode, all exports
are considered command entrypoints, and the linker inserts calls to
`__wasm_call_ctors` and `__wasm_call_dtors` for all such entrypoints.

This enables support for:

- Command entrypoints taking arguments other than strings and return values
   other than `int`.
- Multicall executables without requiring on the use of string-based
   command-line arguments.

This new behavior is disabled when the input has an explicit call to
`__wasm_call_ctors`, indicating code not expecting new-style command
support.

This change does mean that wasm-ld no longer supports DCE-ing the
`__wasm_call_ctors` function when there are no calls to it. If there are no
calls to it, and there are ctors present, we assume it's wasm-ld's job to
insert the calls. This seems ok though, because if there are ctors present,
the program is expecting them to be called. This change affects the
init-fini-gc.ll test.
The file was modifiedlld/wasm/InputChunks.h
The file was modifiedlld/wasm/MarkLive.cpp
The file was modifiedlld/wasm/Symbols.h
The file was addedlld/test/wasm/command-exports.s
The file was addedlld/test/wasm/command-exports-no-tors.s
The file was addedlld/test/wasm/init-fini-no-gc.ll
The file was modifiedlld/wasm/Driver.cpp
The file was removedlld/test/wasm/init-fini-gc.ll
The file was modifiedlld/wasm/Symbols.cpp
The file was modifiedlld/wasm/Writer.cpp
Commit d4a1db4f3fd7ce701454127465dd0ddbdb7face2 by llvm-project
[flang][msvc] Workaround 'forgotten' symbols in FoldOperation. NFC.

This resolves an issue where the Microsoft compiler 'forgets' symbols when using constexpr in a lambda in a templated function. The symbols are:

1. The implicit lambda captures `context` and `convert`. Fix by making them explicit captures. The error message was:
```
fold-implementation.h(1220): error C2065: 'convert': undeclared identifier
```

2. The function template argument FROMCAT. Fix by storing it in a temporary constexpr variable inside the function. The error message was:
```
fold-implementation.h(1216): error C2065: 'FROMCAT': undeclared identifier
```

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D88504
The file was modifiedflang/lib/Evaluate/fold-implementation.h
Commit 12bdd427b33a75bd7abb5d4cb095d0b983328034 by craig.topper
[APFloat] Improve asserts in isSignificandAllOnes and isSignificandAllZeros so they protect shift operations from undefined behavior.

For example, the assert in isSignificandAllZeros allowed NumHighBits
to be integerPartWidth. But since it is used directly as a shift amount
it must be less than integerPartWidth.
The file was modifiedllvm/lib/Support/APFloat.cpp
Commit 4e9277eda1874ead60f2c9d7cdb558fd19b32076 by i
[ELF] --wrap: don't unnecessarily expose __real_

The routing rules are:

sym -> __wrap_sym
__real_sym -> sym

__wrap_sym and sym are routing targets, so they need to be exposed to the symbol
table. __real_sym is not and can be eliminated if not used by regular object.
The file was modifiedlld/ELF/Driver.cpp
The file was modifiedlld/test/ELF/lto/wrap-1.ll
Commit 2c9dc7bbbf514b1ed7bdefacb3213beae5916b3d by michael.hliao
Revert "[llvm-exegesis] Add option to check the hardware support for a given feature before benchmarking."

This reverts commit 4fcd1a8e6528ca42fe656f2745e15d2b7f5de495 as
`llvm/test/tools/llvm-exegesis/X86/lbr/mov-add.s` failed on hosts
without LBR supported if the build has LIBPFM enabled. On that host,
`perf_event_open` fails with `EOPNOTSUPP` on LBR config. That change's
basic assumption

> If this is run on a non-supported hardware, it will produce all zeroes for latency.

could not stand as `perf_event_open` system call will fail if the
underlying hardware really don't have LBR supported.
The file was modifiedllvm/tools/llvm-exegesis/llvm-exegesis.cpp
The file was modifiedllvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp
The file was modifiedllvm/test/tools/llvm-exegesis/X86/lbr/lit.local.cfg
The file was modifiedllvm/tools/llvm-exegesis/lib/X86/Target.cpp
The file was modifiedllvm/tools/llvm-exegesis/lib/Target.h
The file was modifiedllvm/tools/llvm-exegesis/lib/X86/X86Counter.h