Fixes #1912.

Remove the non-effcee build as EFFCEE is now required.
This commit is contained in:
Steven Perron 2018-10-04 10:00:11 -04:00 коммит произвёл GitHub
Родитель 19c07731fc
Коммит c4c68712c4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
40 изменённых файлов: 42 добавлений и 246 удалений

Просмотреть файл

@ -212,10 +212,6 @@ endif()
add_subdirectory(external)
if (TARGET effcee)
add_definitions(-DSPIRV_EFFCEE)
endif()
add_subdirectory(source)
add_subdirectory(tools)

Просмотреть файл

@ -178,7 +178,7 @@ We intend to maintain a linear history on the GitHub `master` branch.
[googletest][googletest] sources, not provided
* `external/effcee`: Location of [Effcee][effcee] sources, if the `effcee` library
is not already configured by an enclosing project.
* `external/re2`: Location of [RE2][re2] sources, if the `effcee` library is not already
* `external/re2`: Location of [RE2][re2] sources, if the `re2` library is not already
configured by an enclosing project.
(The Effcee project already requires RE2.)
* `include/`: API clients should add this directory to the include search path
@ -215,7 +215,7 @@ tests:
The fix is included on the googletest master branch any time after 2015-11-10.
In particular, googletest must be newer than version 1.7.0.
### Optional dependency on Effcee
### Dependency on Effcee
Some tests depend on the [Effcee][effcee] library for stateful matching.
Effcee itself depends on [RE2][re2].
@ -225,7 +225,6 @@ Effcee itself depends on [RE2][re2].
* Otherwise, SPIRV-Tools expects Effcee sources to appear in `external/effcee`
and RE2 sources to appear in `external/re2`.
Currently Effcee is an optional dependency, but soon it will be required.
## Build

74
external/CMakeLists.txt поставляемый
Просмотреть файл

@ -66,57 +66,39 @@ if (NOT ${SPIRV_SKIP_TESTS})
endforeach()
endif()
option(SPIRV_ENABLE_EFFCEE "Enable effcee-based tests" ON)
if (MSVC)
if (MSVC_VERSION LESS 1900)
message(STATUS "SPIRV-Tools: Need Visual Studio 2015 or later for Effcee and RE2")
set(SPIRV_ENABLE_EFFCEE OFF)
endif()
endif()
# Find Effcee and RE2, for testing.
if (SPIRV_ENABLE_EFFCEE)
# Find Effcee and RE2, for testing.
# Optional for now, but eventually we'll make this required.
# First find RE2, since Effcee depends on it.
# If already configured, then use that. Otherwise, prefer to find it under 're2'
# in this directory.
if (NOT TARGET re2)
# If we are configuring RE2, then turn off its testing. It takes a long time and
# does not add much value for us. If an enclosing project configured RE2, then it
# has already chosen whether to enable RE2 tesitng.
set(RE2_BUILD_TESTING OFF CACHE STRING "Run RE2 Tests")
if (NOT RE2_SOURCE_DIR)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/re2)
set(RE2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/re2" CACHE STRING "RE2 source dir" )
endif()
# First find RE2, since Effcee depends on it.
# If already configured, then use that. Otherwise, prefer to find it under 're2'
# in this directory.
if (NOT TARGET re2)
# If we are configuring RE2, then turn off its testing. It takes a long time and
# does not add much value for us. If an enclosing project configured RE2, then it
# has already chosen whether to enable RE2 testing.
set(RE2_BUILD_TESTING OFF CACHE STRING "Run RE2 Tests")
if (NOT RE2_SOURCE_DIR)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/re2)
set(RE2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/re2" CACHE STRING "RE2 source dir" )
endif()
endif()
endif()
if (NOT TARGET effcee)
# Expect to find effcee in this directory.
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/effcee)
# If we're configuring RE2 (via Effcee), then turn off RE2 testing.
if (NOT TARGET re2)
set(RE2_BUILD_TESTING OFF)
endif()
if (MSVC)
# SPIRV-Tools uses the shared CRT with MSVC. Tell Effcee to do the same.
set(EFFCEE_ENABLE_SHARED_CRT ON)
endif()
add_subdirectory(effcee)
set_property(TARGET effcee PROPERTY FOLDER Effcee)
# Turn off warnings for effcee and re2
set_property(TARGET effcee APPEND PROPERTY COMPILE_OPTIONS -w)
set_property(TARGET re2 APPEND PROPERTY COMPILE_OPTIONS -w)
if (NOT TARGET effcee)
# Expect to find effcee in this directory.
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/effcee)
# If we're configuring RE2 (via Effcee), then turn off RE2 testing.
if (NOT TARGET re2)
set(RE2_BUILD_TESTING OFF)
endif()
if (MSVC)
# SPIRV-Tools uses the shared CRT with MSVC. Tell Effcee to do the same.
set(EFFCEE_ENABLE_SHARED_CRT ON)
endif()
add_subdirectory(effcee)
set_property(TARGET effcee PROPERTY FOLDER Effcee)
# Turn off warnings for effcee and re2
set_property(TARGET effcee APPEND PROPERTY COMPILE_OPTIONS -w)
set_property(TARGET re2 APPEND PROPERTY COMPILE_OPTIONS -w)
endif()
# TODO(dneto): Eventually, require this.
endif()
if (TARGET effcee)
message(STATUS "SPIRV-Tools: Effcee is configured")
else()
message(STATUS "SPIRV-Tools: Effcee is not configured. Skipping Effcee-based tests.")
endif()
endif()

Просмотреть файл

@ -1,24 +0,0 @@
#!/bin/bash
# Copyright (c) 2018 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Linux Build Script.
# Fail on any error.
set -e
# Display commands being run.
set -x
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh NO_EFFCEE clang

Просмотреть файл

@ -1,16 +0,0 @@
# Copyright (c) 2018 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Continuous build configuration.
build_file: "SPIRV-Tools/kokoro/linux-clang-no-effcee/build.sh"

Просмотреть файл

@ -1,16 +0,0 @@
# Copyright (c) 2018 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Presubmit build configuration.
build_file: "SPIRV-Tools/kokoro/linux-clang-no-effcee/build.sh"

Просмотреть файл

@ -60,10 +60,6 @@ elif [ $CONFIG = "RELEASE_MINGW" ]
then
ADDITIONAL_CMAKE_FLAGS="-Dgtest_disable_pthreads=ON -DCMAKE_TOOLCHAIN_FILE=$SRC/cmake/linux-mingw-toolchain.cmake"
SKIP_TESTS="True"
elif [ $CONFIG = "NO_EFFCEE" ]
then
ADDITIONAL_CMAKE_FLAGS="-DSPIRV_ENABLE_EFFCEE=OFF"
BUILD_TYPE="RelWithDebInfo"
fi
# Get NINJA.

Просмотреть файл

@ -3873,7 +3873,6 @@ OpFunctionEnd
SinglePassRunAndCheck<AggressiveDCEPass>(before, after, true, true);
}
#ifdef SPIRV_EFFCEE
TEST_F(AggressiveDCETest, DeadNestedSwitch) {
const std::string text = R"(
; CHECK: OpLabel
@ -3919,7 +3918,6 @@ OpFunctionEnd
SinglePassRunAndMatch<AggressiveDCEPass>(text, true);
}
#endif // SPIRV_EFFCEE
TEST_F(AggressiveDCETest, LiveNestedSwitch) {
const std::string text = R"(OpCapability Shader
@ -4095,7 +4093,6 @@ OpFunctionEnd
/* skip_nop = */ true);
}
#ifdef SPIRV_EFFCEE
TEST_F(AggressiveDCETest, BasicAllDeadConstants) {
const std::string text = R"(
; CHECK-NOT: OpConstant
@ -4126,7 +4123,6 @@ TEST_F(AggressiveDCETest, BasicAllDeadConstants) {
SinglePassRunAndMatch<AggressiveDCEPass>(text, true);
}
#endif // SPIRV_EFFCEE
TEST_F(AggressiveDCETest, BasicNoneDeadConstants) {
const std::vector<const char*> text = {
@ -4235,7 +4231,6 @@ const std::vector<std::string> CommonTypes = {
using EliminateDeadConstantTest =
PassTest<::testing::TestWithParam<EliminateDeadConstantTestCase>>;
#ifdef SPIRV_EFFCEE
TEST_P(EliminateDeadConstantTest, Custom) {
auto& tc = GetParam();
AssemblyBuilder builder;
@ -5309,7 +5304,6 @@ OpFunctionEnd
SinglePassRunAndMatch<AggressiveDCEPass>(text, true);
}
#endif // SPIRV_EFFCEE
// Test for #1214
TEST_F(AggressiveDCETest, LoopHeaderIsAlsoAnotherLoopMerge) {

Просмотреть файл

@ -273,7 +273,6 @@ OpFunctionEnd
true);
}
#ifdef SPIRV_EFFCEE
TEST_F(BlockMergeTest, PhiInSuccessorOfMergedBlock) {
const std::string text = R"(
; CHECK: OpSelectionMerge [[merge:%\w+]] None
@ -741,7 +740,6 @@ OpFunctionEnd
SinglePassRunAndMatch<BlockMergePass>(text, true);
}
#endif // SPIRV_EFFCEE
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//

Просмотреть файл

@ -26,8 +26,6 @@ namespace {
using CCPTest = PassTest<::testing::Test>;
// TODO(dneto): Add Effcee as required dependency, and make this unconditional.
#ifdef SPIRV_EFFCEE
TEST_F(CCPTest, PropagateThroughPhis) {
const std::string spv_asm = R"(
OpCapability Shader
@ -897,7 +895,6 @@ OpFunctionEnd
SinglePassRunAndMatch<CCPPass>(text, true);
}
#endif
} // namespace
} // namespace opt

Просмотреть файл

@ -25,7 +25,6 @@ namespace {
using CombineAccessChainsTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(CombineAccessChainsTest, PtrAccessChainFromAccessChainConstant) {
const std::string text = R"(
; CHECK: [[int:%\w+]] = OpTypeInt 32 0
@ -768,7 +767,6 @@ OpFunctionEnd
SinglePassRunAndMatch<CombineAccessChains>(text, true);
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace opt

Просмотреть файл

@ -1219,7 +1219,6 @@ OpFunctionEnd
predefs + after, true, true);
}
#ifdef SPIRV_EFFCEE
TEST_F(CommonUniformElimTest, MixedConstantAndNonConstantIndexes) {
const std::string text = R"(
; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Uniform
@ -1329,7 +1328,7 @@ TEST_F(CommonUniformElimTest, MixedConstantAndNonConstantIndexes) {
SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
SinglePassRunAndMatch<CommonUniformElimPass>(text, true);
}
#endif // SPIRV_EFFCEE
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//
// Disqualifying cases: extensions, decorations, non-logical addressing,

Просмотреть файл

@ -25,7 +25,6 @@ namespace {
using CopyPropArrayPassTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(CopyPropArrayPassTest, BasicPropagateArray) {
const std::string before =
R"(
@ -825,7 +824,6 @@ TEST_F(CopyPropArrayPassTest, IsomorphicTypes3) {
SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES);
SinglePassRunAndMatch<CopyPropagateArrays>(before, false);
}
#endif // SPIRV_EFFCEE
// This test will place a load before the store. We cannot propagate in this
// case.

Просмотреть файл

@ -1348,7 +1348,6 @@ OpFunctionEnd
true, true);
}
#ifdef SPIRV_EFFCEE
TEST_F(DeadBranchElimTest, LeaveContinueBackedge) {
const std::string text = R"(
; CHECK: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None
@ -2492,7 +2491,6 @@ OpFunctionEnd
SinglePassRunAndMatch<DeadBranchElimPass>(predefs + body, true);
}
#endif
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//

Просмотреть файл

@ -17,6 +17,7 @@
#include <unordered_set>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "source/opt/build_module.h"
@ -27,17 +28,12 @@
#include "spirv-tools/libspirv.hpp"
#include "test/opt/pass_utils.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
using ::testing::Contains;
#ifdef SPIRV_EFFCEE
std::string Disassemble(const std::string& original, IRContext* context,
uint32_t disassemble_options = 0) {
std::vector<uint32_t> optimized_bin;
@ -60,7 +56,6 @@ void Match(const std::string& original, IRContext* context,
<< match_result.message() << "\nChecking result:\n"
<< disassembly;
}
#endif
template <class ResultType>
struct InstructionFoldingCase {
@ -3851,7 +3846,6 @@ INSTANTIATE_TEST_CASE_P(DoubleRedundantSubFoldingTest, ToNegateFoldingTest,
2, 3)
));
#ifdef SPIRV_EFFCEE
using MatchingInstructionFoldingTest =
::testing::TestWithParam<InstructionFoldingCase<bool>>;
@ -6075,7 +6069,6 @@ INSTANTIATE_TEST_CASE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResu
"OpFunctionEnd",
9, true)
));
#endif
} // namespace
} // namespace opt

Просмотреть файл

@ -25,7 +25,6 @@ namespace {
using IfConversionTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(IfConversionTest, TestSimpleIfThenElse) {
const std::string text = R"(
; CHECK: OpSelectionMerge [[merge:%\w+]]
@ -302,7 +301,6 @@ TEST_F(IfConversionTest, CodeMotionMultipleInstructions) {
SinglePassRunAndMatch<IfConversion>(text, true);
}
#endif // SPIRV_EFFCEE
TEST_F(IfConversionTest, NoCommonDominator) {
const std::string text = R"(OpCapability Shader

Просмотреть файл

@ -2589,7 +2589,6 @@ TEST_F(InlineTest, SetParent) {
}
}
#ifdef SPIRV_EFFCEE
TEST_F(InlineTest, OpKill) {
const std::string text = R"(
; CHECK: OpFunction
@ -2844,7 +2843,6 @@ TEST_F(InlineTest, OpVariableWithInit) {
SinglePassRunAndMatch<InlineExhaustivePass>(text, true);
}
#endif
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//

Просмотреть файл

@ -17,6 +17,7 @@
#include <string>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "source/opt/basic_block.h"
@ -26,16 +27,10 @@
#include "source/opt/type_manager.h"
#include "spirv-tools/libspirv.hpp"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
#ifdef SPIRV_EFFCEE
using Analysis = IRContext::Analysis;
using IRBuilderTest = ::testing::Test;
@ -409,8 +404,6 @@ OpFunctionEnd
Match(text, context.get());
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -24,8 +24,6 @@ namespace {
using LocalAccessChainConvertTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(LocalAccessChainConvertTest, StructOfVecsOfFloatConverted) {
// #version 140
//
@ -625,7 +623,6 @@ OpFunctionEnd
SinglePassRunAndMatch<LocalAccessChainConvertPass>(predefs_before + before,
true);
}
#endif // SPIRV_EFFCEE
TEST_F(LocalAccessChainConvertTest, DynamicallyIndexedVarNotConverted) {
// #version 140

Просмотреть файл

@ -29,7 +29,6 @@ using ::testing::HasSubstr;
using ::testing::MatchesRegex;
using LocalRedundancyEliminationTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
// Remove an instruction when it was already computed.
TEST_F(LocalRedundancyEliminationTest, RemoveRedundantAdd) {
const std::string text = R"(
@ -154,7 +153,6 @@ TEST_F(LocalRedundancyEliminationTest, KeepInstructionsInDifferentBlocks) {
)";
SinglePassRunAndMatch<LocalRedundancyEliminationPass>(text, false);
}
#endif
} // namespace
} // namespace opt

Просмотреть файл

@ -1624,8 +1624,6 @@ OpFunctionEnd
EXPECT_TRUE(status == Pass::Status::SuccessWithChange);
}
// TODO(dneto): Add Effcee as required dependency, and make this unconditional.
#ifdef SPIRV_EFFCEE
TEST_F(LocalSSAElimTest, CompositeExtractProblem) {
const std::string spv_asm = R"(
OpCapability Tessellation
@ -1758,7 +1756,6 @@ TEST_F(LocalSSAElimTest, DecoratedVariable) {
SinglePassRunAndMatch<SSARewritePass>(spv_asm, true);
}
#endif
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//

Просмотреть файл

@ -18,15 +18,12 @@
#include <string>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "source/opt/loop_descriptor.h"
#include "source/opt/loop_fusion.h"
#include "test/opt/pass_fixture.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
@ -52,7 +49,6 @@ void Match(const std::string& checks, IRContext* context) {
std::vector<uint32_t> bin;
context->module()->ToBinary(&bin, true);
EXPECT_TRUE(Validate(bin));
#ifdef SPIRV_EFFCEE
std::string assembly;
SpirvTools tools(SPV_ENV_UNIVERSAL_1_2);
EXPECT_TRUE(
@ -63,9 +59,6 @@ void Match(const std::string& checks, IRContext* context) {
EXPECT_EQ(effcee::Result::Status::Ok, match_result.status())
<< match_result.message() << "\nChecking result:\n"
<< assembly;
#else // ! SPIRV_EFFCEE
(void)checks;
#endif
}
/*

Просмотреть файл

@ -14,21 +14,16 @@
#include <string>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "test/opt/pass_fixture.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
using FusionPassTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
/*
Generated from the following GLSL + --eliminate-local-multi-store
@ -717,8 +712,6 @@ TEST_F(FusionPassTest, TooManyRegisters) {
SinglePassRunAndMatch<LoopFusionPass>(text, true, 5);
}
#endif
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -45,7 +45,6 @@ void main(){
}
}
*/
#ifdef SPIRV_EFFCEE
TEST_F(PassClassTest, HoistWithoutPreheader) {
const std::string text = R"(OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
@ -117,7 +116,6 @@ OpFunctionEnd
SinglePassRunAndMatch<LICMPass>(text, false);
}
#endif
} // namespace
} // namespace opt

Просмотреть файл

@ -16,6 +16,7 @@
#include <string>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "source/opt/build_module.h"
#include "source/opt/loop_descriptor.h"
@ -24,16 +25,10 @@
#include "test/opt//assembly_builder.h"
#include "test/opt/function_utils.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
#ifdef SPIRV_EFFCEE
bool Validate(const std::vector<uint32_t>& bin) {
spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
spv_context spvContext = spvContextCreate(target_env);
@ -607,8 +602,6 @@ TEST_F(LCSSATest, LCSSAUseInNonEligiblePhi) {
Match(text, context.get());
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -16,16 +16,13 @@
#include <string>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "source/opt/ir_builder.h"
#include "source/opt/loop_descriptor.h"
#include "source/opt/loop_peeling.h"
#include "test/opt/pass_fixture.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
@ -51,7 +48,6 @@ void Match(const std::string& checks, IRContext* context) {
std::vector<uint32_t> bin;
context->module()->ToBinary(&bin, true);
EXPECT_TRUE(Validate(bin));
#ifdef SPIRV_EFFCEE
std::string assembly;
SpirvTools tools(SPV_ENV_UNIVERSAL_1_2);
EXPECT_TRUE(
@ -62,9 +58,6 @@ void Match(const std::string& checks, IRContext* context) {
EXPECT_EQ(effcee::Result::Status::Ok, match_result.status())
<< match_result.message() << "\nChecking result:\n"
<< assembly;
#else // ! SPIRV_EFFCEE
(void)checks;
#endif
}
/*

Просмотреть файл

@ -2952,7 +2952,6 @@ OpFunctionEnd
EXPECT_NE(loop_2.GetLatchBlock(), loop_2.GetContinueBlock());
}
#ifdef SPIRV_EFFCEE
// Test that a loop with a self-referencing OpPhi instruction is handled
// correctly.
TEST_F(PassClassTest, OpPhiSelfReference) {
@ -2998,7 +2997,6 @@ TEST_F(PassClassTest, OpPhiSelfReference) {
SinglePassRunAndMatch<opt::LoopUnroller>(text, true, kFullyUnroll,
kUnrollFactor);
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace opt

Просмотреть файл

@ -14,21 +14,16 @@
#include <string>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "test/opt/pass_fixture.h"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace {
using UnswitchTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
/*
Generated from the following GLSL + --eliminate-local-multi-store
@ -809,7 +804,6 @@ TEST_F(UnswitchTest, UnSwitchNested) {
SinglePassRunAndMatch<LoopUnswitchPass>(text, true);
}
#endif // SPIRV_EFFCEE
/*
Generated from the following GLSL + --eliminate-local-multi-store

Просмотреть файл

@ -22,6 +22,7 @@
#include <utility>
#include <vector>
#include "effcee/effcee.h"
#include "gtest/gtest.h"
#include "source/opt/build_module.h"
#include "source/opt/pass_manager.h"
@ -29,10 +30,6 @@
#include "source/util/make_unique.h"
#include "spirv-tools/libspirv.hpp"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
@ -163,7 +160,6 @@ class PassTest : public TestT {
std::forward<Args>(args)...);
}
#ifdef SPIRV_EFFCEE
// Runs a single pass of class |PassT| on the binary assembled from the
// |original| assembly, then runs an Effcee matcher over the disassembled
// result, using checks parsed from |original|. Always skips OpNop.
@ -181,7 +177,6 @@ class PassTest : public TestT {
<< match_result.message() << "\nChecking result:\n"
<< disassembly;
}
#endif
// Adds a pass to be run.
template <typename PassT, typename... Args>
@ -232,8 +227,8 @@ class PassTest : public TestT {
}
private:
MessageConsumer consumer_; // Message consumer.
std::unique_ptr<IRContext> context_; // IR context
MessageConsumer consumer_; // Message consumer.
std::unique_ptr<IRContext> context_; // IR context
SpirvTools tools_; // An instance for calling SPIRV-Tools functionalities.
std::unique_ptr<PassManager> manager_; // The pass manager.
uint32_t assemble_options_;

Просмотреть файл

@ -257,7 +257,6 @@ OpFunctionEnd
SinglePassRunAndCheck<MergeReturnPass>(before, after, false, true);
}
#ifdef SPIRV_EFFCEE
TEST_F(MergeReturnPassTest, StructuredControlFlowWithUnreachableMerge) {
const std::string before =
R"(
@ -1019,7 +1018,6 @@ OpFunctionEnd
SinglePassRunAndMatch<MergeReturnPass>(test, false);
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace opt

Просмотреть файл

@ -29,7 +29,6 @@ using ::testing::HasSubstr;
using ::testing::MatchesRegex;
using PrivateToLocalTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(PrivateToLocalTest, ChangeToLocal) {
// Change the private variable to a local, and change the types accordingly.
const std::string text = R"(
@ -309,8 +308,6 @@ TEST_F(PrivateToLocalTest, CreatePointerToAmbiguousStruct2) {
SinglePassRunAndMatch<PrivateToLocalPass>(text, false);
}
#endif
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -23,7 +23,6 @@ namespace {
using ReduceLoadSizeTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(ReduceLoadSizeTest, cbuffer_load_extract) {
// Originally from the following HLSL:
// struct S {
@ -107,7 +106,6 @@ TEST_F(ReduceLoadSizeTest, cbuffer_load_extract) {
SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES);
SinglePassRunAndMatch<ReduceLoadSize>(test, false);
}
#endif
TEST_F(ReduceLoadSizeTest, cbuffer_load_extract_vector) {
// Originally from the following HLSL:

Просмотреть файл

@ -29,7 +29,6 @@ using ::testing::HasSubstr;
using ::testing::MatchesRegex;
using RedundancyEliminationTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
// Test that it can get a simple case of local redundancy elimination.
// The rest of the test check for extra functionality.
TEST_F(RedundancyEliminationTest, RemoveRedundantLocalAdd) {
@ -273,8 +272,6 @@ TEST_F(RedundancyEliminationTest, KeepRedundantAddWithoutPhi) {
EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result));
}
#endif
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -26,7 +26,6 @@ namespace {
using ReplaceInvalidOpcodeTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(ReplaceInvalidOpcodeTest, ReplaceInstruction) {
const std::string text = R"(
; CHECK: [[special_const:%\w+]] = OpConstant %float -6.2598534e+18
@ -589,8 +588,6 @@ TEST_F(ReplaceInvalidOpcodeTest, MultipleMessageTest) {
EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result));
}
#endif
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -25,8 +25,6 @@ namespace {
using ScalarReplacementTest = PassTest<::testing::Test>;
// TODO(dneto): Add Effcee as required dependency, and make this unconditional.
#ifdef SPIRV_EFFCEE
TEST_F(ScalarReplacementTest, SimpleStruct) {
const std::string text = R"(
;
@ -1448,7 +1446,6 @@ OpFunctionEnd
SinglePassRunAndMatch<ScalarReplacementPass>(text, true);
}
#endif // SPIRV_EFFCEE
// Test that a struct of size 4 is not replaced when there is a limit of 2.
TEST_F(ScalarReplacementTest, TestLimit) {

Просмотреть файл

@ -25,7 +25,6 @@ namespace {
using SimplificationTest = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(SimplificationTest, StraightLineTest) {
// Testing that folding rules are combined in simple straight line code.
const std::string text = R"(OpCapability Shader
@ -203,8 +202,6 @@ TEST_F(SimplificationTest, ThroughLoops) {
SinglePassRunAndMatch<SimplificationPass>(text, false);
}
#endif
} // namespace
} // namespace opt
} // namespace spvtools

Просмотреть файл

@ -65,7 +65,6 @@ TEST_F(StrengthReductionBasicTest, BasicReplaceMulBy8) {
}
// TODO(dneto): Add Effcee as required dependency, and make this unconditional.
#ifdef SPIRV_EFFCEE
// Test to make sure we replace 16*5
// Also demonstrate use of Effcee matching.
TEST_F(StrengthReductionBasicTest, BasicReplaceMulBy16) {
@ -102,7 +101,6 @@ TEST_F(StrengthReductionBasicTest, BasicReplaceMulBy16) {
SinglePassRunAndMatch<StrengthReductionPass>(text, false);
}
#endif
// Test to make sure we replace a multiple of 32 and 4.
TEST_F(StrengthReductionBasicTest, BasicTwoPowersOf2) {

Просмотреть файл

@ -17,6 +17,7 @@
#include <utility>
#include <vector>
#include "effcee/effcee.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "source/opt/build_module.h"
@ -24,17 +25,11 @@
#include "source/opt/type_manager.h"
#include "spirv-tools/libspirv.hpp"
#ifdef SPIRV_EFFCEE
#include "effcee/effcee.h"
#endif
namespace spvtools {
namespace opt {
namespace analysis {
namespace {
#ifdef SPIRV_EFFCEE
bool Validate(const std::vector<uint32_t>& bin) {
spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
spv_context spvContext = spvContextCreate(target_env);
@ -66,8 +61,6 @@ void Match(const std::string& original, IRContext* context,
<< assembly;
}
#endif
std::vector<std::unique_ptr<Type>> GenerateAllTypes() {
// Types in this test case are only equal to themselves, nothing else.
std::vector<std::unique_ptr<Type>> types;
@ -939,7 +932,6 @@ OpMemoryModel Logical GLSL450
EXPECT_EQ(nullptr, context->get_type_mgr()->GetType(id));
}
#ifdef SPIRV_EFFCEE
TEST(TypeManager, GetTypeInstructionInt) {
const std::string text = R"(
; CHECK: OpTypeInt 32 0
@ -1145,7 +1137,6 @@ OpMemoryModel Logical GLSL450
context->get_type_mgr()->FindPointerToType(2, SpvStorageClassFunction);
Match(text, context.get());
}
#endif // SPIRV_EFFCEE
} // namespace
} // namespace analysis

Просмотреть файл

@ -611,7 +611,6 @@ OpFunctionEnd
SinglePassRunAndCheck<DeadInsertElimPass>(before, before, true, true);
}
#ifdef SPIRV_EFFCEE
TEST_F(VectorDCETest, DeadInsertInCycle) {
// Dead insert in chain with cycle. Demonstrates analysis can handle
// cycles in chains going through scalars intermediate values.
@ -1078,7 +1077,6 @@ TEST_F(VectorDCETest, DeadInsertThroughOtherInst) {
SinglePassRunAndMatch<VectorDCE>(assembly, true);
}
#endif
TEST_F(VectorDCETest, VectorIntoCompositeConstruct) {
const std::string text = R"(OpCapability Linkage

Просмотреть файл

@ -30,7 +30,6 @@ namespace {
using Workaround1209Test = PassTest<::testing::Test>;
#ifdef SPIRV_EFFCEE
TEST_F(Workaround1209Test, RemoveOpUnreachableInLoop) {
const std::string text = R"(
OpCapability Shader
@ -418,7 +417,6 @@ TEST_F(Workaround1209Test, LeaveUnreachableNotInLoop) {
SinglePassRunAndMatch<Workaround1209>(text, false);
}
#endif
} // namespace
} // namespace opt