diff --git a/CMakeLists.txt b/CMakeLists.txt index a63fd2d4b1..87e9a6ad92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,6 +131,15 @@ if(LLVM_ENABLE_ZLIB) find_package(ZLIB) endif() +#------------------------------------------------------------------------------- +# Compiler options +#------------------------------------------------------------------------------- + +if(MSVC) + # Required to use M_PI. Must be set before any `#include `. + add_compile_definitions("_USE_MATH_DEFINES") +endif() + #------------------------------------------------------------------------------- # Performance configuration #------------------------------------------------------------------------------- diff --git a/stablehlo/transforms/ChloLegalizeToStablehlo.cpp b/stablehlo/transforms/ChloLegalizeToStablehlo.cpp index b6d75b376b..ef3a60756a 100644 --- a/stablehlo/transforms/ChloLegalizeToStablehlo.cpp +++ b/stablehlo/transforms/ChloLegalizeToStablehlo.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -18,33 +19,30 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Sequence.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" #include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/Shape/IR/Shape.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinAttributeInterfaces.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinTypeInterfaces.h" -#include "mlir/IR/ValueRange.h" -#include "mlir/Rewrite/FrozenRewritePatternSet.h" -#include "mlir/Support/LLVM.h" -#include "stablehlo/dialect/Base.h" -#define _USE_MATH_DEFINES -#include - -#include "llvm/ADT/STLExtras.h" -#include "mlir/Dialect/Complex/IR/Complex.h" -#include "mlir/Dialect/Shape/IR/Shape.h" -#include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/ImplicitLocOpBuilder.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/PatternMatch.h" #include "mlir/IR/TypeUtilities.h" +#include "mlir/IR/ValueRange.h" +#include "mlir/Rewrite/FrozenRewritePatternSet.h" +#include "mlir/Support/LLVM.h" #include "mlir/Support/LogicalResult.h" #include "mlir/Transforms/DialectConversion.h" +#include "stablehlo/dialect/Base.h" #include "stablehlo/dialect/BroadcastUtils.h" #include "stablehlo/dialect/ChloOps.h" #include "stablehlo/dialect/StablehloOps.h"