Index: llvm/lib/Support/NativeFormatting.cpp =================================================================== --- llvm/lib/Support/NativeFormatting.cpp +++ llvm/lib/Support/NativeFormatting.cpp @@ -168,7 +168,7 @@ S << "nan"; return; } else if (std::isinf(N)) { - S << "INF"; + S << (std::signbit(N) ? "-INF" : "INF"); return; } Index: llvm/unittests/Support/NativeFormatTests.cpp =================================================================== --- llvm/unittests/Support/NativeFormatTests.cpp +++ llvm/unittests/Support/NativeFormatTests.cpp @@ -125,6 +125,8 @@ FloatStyle::Fixed)); EXPECT_EQ("INF", format_number(std::numeric_limits::infinity(), FloatStyle::Fixed)); + EXPECT_EQ("-INF", format_number(-std::numeric_limits::infinity(), + FloatStyle::Fixed)); } TEST(NativeFormatTest, HexTests) {