Skip to content

Commit fdde077

Browse files
authored
[NFC] Remove unused functions in ExecutionTest.cpp and assert.cpp (microsoft#7129) (microsoft#7132)
Some functions need to be removed / changed to unblock some internal pipelines. They are emitting warnings that they are unused. Specifically, `CompareOutputWithExpectedValueFloat`, `CompareOutputWithExpectedValueHalf`, and `CompareOutputWithExpectedValueFloat` need to be removed because they are unused. Additionally, there is a case in assert.cpp where `llvm_assert_trap` is left unused depending on what's been defined and how the preprocessor directives execute. This needs to be remedied so that the function is only defined when it is used.
1 parent d70a3fa commit fdde077

File tree

2 files changed

+3
-54
lines changed

2 files changed

+3
-54
lines changed

lib/Support/assert.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "assert.h"
1111
#include "llvm/Support/Compiler.h"
1212
#include "llvm/Support/raw_ostream.h"
13+
14+
#if defined(LLVM_ASSERTIONS_TRAP) || !defined(WIN32)
1315
namespace {
1416
void llvm_assert_trap(const char *_Message, const char *_File, unsigned _Line,
1517
const char *_Function) {
@@ -18,6 +20,7 @@ void llvm_assert_trap(const char *_Message, const char *_File, unsigned _Line,
1820
LLVM_BUILTIN_TRAP;
1921
}
2022
} // namespace
23+
#endif
2124

2225
#ifdef _WIN32
2326
#include "dxc/Support/Global.h"

tools/clang/unittests/HLSLExec/ExecutionTest.cpp

-54
Original file line numberDiff line numberDiff line change
@@ -6880,22 +6880,6 @@ ToleranceType ToleranceStringToEnum(LPCWSTR toleranceType) {
68806880
}
68816881
}
68826882

6883-
static bool CompareOutputWithExpectedValueFloat(
6884-
float output, float ref, ToleranceType type, double tolerance,
6885-
hlsl::DXIL::Float32DenormMode mode = hlsl::DXIL::Float32DenormMode::Any) {
6886-
if (type == ToleranceType::RELATIVE_EPSILON) {
6887-
return CompareFloatRelativeEpsilon(output, ref, (int)tolerance, mode);
6888-
} else if (type == ToleranceType::EPSILON) {
6889-
return CompareFloatEpsilon(output, ref, (float)tolerance, mode);
6890-
} else if (type == ToleranceType::ULP) {
6891-
return CompareFloatULP(output, ref, (int)tolerance, mode);
6892-
} else {
6893-
LogErrorFmt(L"Failed to read comparison type %S", type);
6894-
}
6895-
6896-
return false;
6897-
}
6898-
68996883
static bool CompareOutputWithExpectedValueFloat(
69006884
float output, float ref, LPCWSTR type, double tolerance,
69016885
hlsl::DXIL::Float32DenormMode mode = hlsl::DXIL::Float32DenormMode::Any) {
@@ -6919,21 +6903,6 @@ static bool VerifyOutputWithExpectedValueFloat(
69196903
CompareOutputWithExpectedValueFloat(output, ref, type, tolerance, mode));
69206904
}
69216905

6922-
static bool CompareOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
6923-
ToleranceType type,
6924-
double tolerance) {
6925-
if (type == ToleranceType::RELATIVE_EPSILON) {
6926-
return CompareHalfRelativeEpsilon(output, ref, (int)tolerance);
6927-
} else if (type == ToleranceType::EPSILON) {
6928-
return CompareHalfEpsilon(output, ref, (float)tolerance);
6929-
} else if (type == ToleranceType::ULP) {
6930-
return CompareHalfULP(output, ref, (float)tolerance);
6931-
} else {
6932-
LogErrorFmt(L"Failed to read comparison type %S", type);
6933-
return false;
6934-
}
6935-
}
6936-
69376906
static bool CompareOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
69386907
LPCWSTR type, double tolerance) {
69396908
if (_wcsicmp(type, L"Relative") == 0) {
@@ -6954,29 +6923,6 @@ static bool VerifyOutputWithExpectedValueHalf(uint16_t output, uint16_t ref,
69546923
CompareOutputWithExpectedValueHalf(output, ref, type, tolerance));
69556924
}
69566925

6957-
template <typename T>
6958-
static bool CompareOutputWithExpectedValue(T output, T ref,
6959-
ToleranceType toleranceType,
6960-
double tolerance) {
6961-
if (std::is_same<T, DirectX::PackedVector::HALF>::value) { // uint16 treated
6962-
// as half
6963-
return CompareOutputWithExpectedValueHalf((uint16_t)output, (uint16_t)ref,
6964-
toleranceType, tolerance);
6965-
} else if (std::is_integral<T>::value &&
6966-
std::is_signed<T>::value) { // signed ints
6967-
return CompareOutputWithExpectedValueInt((int)output, (int)ref,
6968-
(int)tolerance);
6969-
} else if (std::is_integral<T>::value) { // unsigned ints
6970-
return CompareOutputWithExpectedValueUInt((uint32_t)output, (uint32_t)ref,
6971-
(uint32_t)tolerance);
6972-
} else if (std::is_floating_point<T>::value) { // floating point
6973-
return CompareOutputWithExpectedValueFloat((float)output, (float)ref,
6974-
toleranceType, tolerance);
6975-
}
6976-
6977-
DXASSERT_NOMSG("Invalid Parameter Type");
6978-
}
6979-
69806926
template <typename T>
69816927
static bool CompareOutputWithExpectedValue(T output, T ref,
69826928
LPCWSTR toleranceType,

0 commit comments

Comments
 (0)