[PATCH] D113511: [mlir] Optimize usage of llvm::mapped_iterator

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 24 06:48:43 PST 2022


aganea added inline comments.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman.
Herald added a project: All.


================
Comment at: mlir/include/mlir/IR/BuiltinAttributes.h:353
+    std::complex<APFloat> mapElement(const std::complex<APInt> &value) const {
+      return {APFloat(*smt, value.real()), APFloat(*smt, value.imag())};
+    }
----------------
Hello! With a recent version of MSVC 2022 (using 17.4.1) I'm seeing a bunch of warnings, such as:
```
[2055/3926] Building CXX object tools\mlir\lib\IR\CMakeFiles\obj.MLIRIR.dir\BuiltinAttributes.cpp.obj
D:\git\llvm-project\mlir\include\mlir/IR/BuiltinAttributes.h(353): warning C4996: 'std::complex<llvm::APFloat>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning.
D:\git\llvm-project\mlir\lib\IR\BuiltinAttributes.cpp(683): warning C4996: 'std::complex<llvm::APInt>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning.
D:\git\llvm-project\stage1_msvc_debug\tools\mlir\include\mlir/IR/BuiltinAttributes.h.inc(529): warning C4996: 'std::complex<llvm::APInt>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning.
D:\git\llvm-project\mlir\include\mlir/IR/BuiltinAttributes.h(985): note: see reference to function template instantiation 'std::complex<llvm::APInt> mlir::SparseElementsAttr::getZeroValue<T>(void) const' being compiled
        with
        [
            T=std::complex<llvm::APInt>
        ]
D:\git\llvm-project\stage1_msvc_debug\tools\mlir\include\mlir/IR/BuiltinAttributeInterfaces.h.inc(310): note: see reference to function template instantiation 'mlir::FailureOr<llvm::mapped_iterator<llvm::detail::SafeIntIterator<__int64,false>,std::function<T (ptrdiff_t)>,_Ret>> mlir::SparseElementsAttr::try_value_begin_impl<T>(mlir::detail::ElementsAttrTrait<ConcreteAttr>::OverloadToken<T>) const' being compiled
        with
        [
            T=std::complex<llvm::APInt>,
            _Ret=std::complex<llvm::APInt>,
            ConcreteAttr=mlir::SparseElementsAttr
        ]
```
I'm not sure what to do with this. It seems usage of `std::complex` with anything else than `float`, `double` or `long double` is UB: https://en.cppreference.com/w/cpp/numeric/complex


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113511



More information about the llvm-commits mailing list