Skip to content

Commit fe47ed6

Browse files
committed
Fix the build for MSVC builds using M_PI
llvm-svn: 370405
1 parent 3d705a1 commit fe47ed6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
/// \todo This should be generated by TableGen.
1212
//===----------------------------------------------------------------------===//
1313

14+
#if defined(_MSC_VER) || defined(__MINGW32__)
15+
// According to Microsoft, one must set _USE_MATH_DEFINES in order to get M_PI
16+
// from the Visual C++ cmath / math.h headers:
17+
// https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=vs-2019
18+
#define _USE_MATH_DEFINES
19+
#endif
20+
1421
#include "AMDGPU.h"
1522
#include "AMDGPULegalizerInfo.h"
1623
#include "AMDGPUTargetMachine.h"

0 commit comments

Comments
 (0)