diff --git a/CMakeLists.txt b/CMakeLists.txt index 27655b90..28077f2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,10 +212,6 @@ endif() add_subdirectory(external) -if (TARGET effcee) - add_definitions(-DSPIRV_EFFCEE) -endif() - add_subdirectory(source) add_subdirectory(tools) diff --git a/README.md b/README.md index cf534c25..cb56e636 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 1777752e..d1251c24 100644 --- a/external/CMakeLists.txt +++ b/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() diff --git a/kokoro/linux-clang-no-effcee/build.sh b/kokoro/linux-clang-no-effcee/build.sh deleted file mode 100644 index 54ecc46d..00000000 --- a/kokoro/linux-clang-no-effcee/build.sh +++ /dev/null @@ -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 diff --git a/kokoro/linux-clang-no-effcee/continuous.cfg b/kokoro/linux-clang-no-effcee/continuous.cfg deleted file mode 100644 index 13f221ff..00000000 --- a/kokoro/linux-clang-no-effcee/continuous.cfg +++ /dev/null @@ -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" diff --git a/kokoro/linux-clang-no-effcee/presubmit.cfg b/kokoro/linux-clang-no-effcee/presubmit.cfg deleted file mode 100644 index 30c9b83b..00000000 --- a/kokoro/linux-clang-no-effcee/presubmit.cfg +++ /dev/null @@ -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" diff --git a/kokoro/scripts/linux/build.sh b/kokoro/scripts/linux/build.sh index 599a43fd..d457539d 100644 --- a/kokoro/scripts/linux/build.sh +++ b/kokoro/scripts/linux/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. diff --git a/test/opt/aggressive_dead_code_elim_test.cpp b/test/opt/aggressive_dead_code_elim_test.cpp index a53a2e0e..5d73172b 100644 --- a/test/opt/aggressive_dead_code_elim_test.cpp +++ b/test/opt/aggressive_dead_code_elim_test.cpp @@ -3873,7 +3873,6 @@ OpFunctionEnd SinglePassRunAndCheck(before, after, true, true); } -#ifdef SPIRV_EFFCEE TEST_F(AggressiveDCETest, DeadNestedSwitch) { const std::string text = R"( ; CHECK: OpLabel @@ -3919,7 +3918,6 @@ OpFunctionEnd SinglePassRunAndMatch(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(text, true); } -#endif // SPIRV_EFFCEE TEST_F(AggressiveDCETest, BasicNoneDeadConstants) { const std::vector text = { @@ -4235,7 +4231,6 @@ const std::vector CommonTypes = { using EliminateDeadConstantTest = PassTest<::testing::TestWithParam>; -#ifdef SPIRV_EFFCEE TEST_P(EliminateDeadConstantTest, Custom) { auto& tc = GetParam(); AssemblyBuilder builder; @@ -5309,7 +5304,6 @@ OpFunctionEnd SinglePassRunAndMatch(text, true); } -#endif // SPIRV_EFFCEE // Test for #1214 TEST_F(AggressiveDCETest, LoopHeaderIsAlsoAnotherLoopMerge) { diff --git a/test/opt/block_merge_test.cpp b/test/opt/block_merge_test.cpp index ad681b30..654e8801 100644 --- a/test/opt/block_merge_test.cpp +++ b/test/opt/block_merge_test.cpp @@ -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(text, true); } -#endif // SPIRV_EFFCEE // TODO(greg-lunarg): Add tests to verify handling of these cases: // diff --git a/test/opt/ccp_test.cpp b/test/opt/ccp_test.cpp index 0478b376..20d883b0 100644 --- a/test/opt/ccp_test.cpp +++ b/test/opt/ccp_test.cpp @@ -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(text, true); } -#endif } // namespace } // namespace opt diff --git a/test/opt/combine_access_chains_test.cpp b/test/opt/combine_access_chains_test.cpp index 67322608..aed14c9d 100644 --- a/test/opt/combine_access_chains_test.cpp +++ b/test/opt/combine_access_chains_test.cpp @@ -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(text, true); } -#endif // SPIRV_EFFCEE } // namespace } // namespace opt diff --git a/test/opt/common_uniform_elim_test.cpp b/test/opt/common_uniform_elim_test.cpp index f5199ed8..76ab3441 100644 --- a/test/opt/common_uniform_elim_test.cpp +++ b/test/opt/common_uniform_elim_test.cpp @@ -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(text, true); } -#endif // SPIRV_EFFCEE + // TODO(greg-lunarg): Add tests to verify handling of these cases: // // Disqualifying cases: extensions, decorations, non-logical addressing, diff --git a/test/opt/copy_prop_array_test.cpp b/test/opt/copy_prop_array_test.cpp index 61e750a3..1391153f 100644 --- a/test/opt/copy_prop_array_test.cpp +++ b/test/opt/copy_prop_array_test.cpp @@ -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(before, false); } -#endif // SPIRV_EFFCEE // This test will place a load before the store. We cannot propagate in this // case. diff --git a/test/opt/dead_branch_elim_test.cpp b/test/opt/dead_branch_elim_test.cpp index 0fd26022..b4aff709 100644 --- a/test/opt/dead_branch_elim_test.cpp +++ b/test/opt/dead_branch_elim_test.cpp @@ -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(predefs + body, true); } -#endif // TODO(greg-lunarg): Add tests to verify handling of these cases: // diff --git a/test/opt/fold_test.cpp b/test/opt/fold_test.cpp index b1e57588..e4dabe85 100644 --- a/test/opt/fold_test.cpp +++ b/test/opt/fold_test.cpp @@ -17,6 +17,7 @@ #include #include +#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 optimized_bin; @@ -60,7 +56,6 @@ void Match(const std::string& original, IRContext* context, << match_result.message() << "\nChecking result:\n" << disassembly; } -#endif template struct InstructionFoldingCase { @@ -3851,7 +3846,6 @@ INSTANTIATE_TEST_CASE_P(DoubleRedundantSubFoldingTest, ToNegateFoldingTest, 2, 3) )); -#ifdef SPIRV_EFFCEE using MatchingInstructionFoldingTest = ::testing::TestWithParam>; @@ -6075,7 +6069,6 @@ INSTANTIATE_TEST_CASE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResu "OpFunctionEnd", 9, true) )); -#endif } // namespace } // namespace opt diff --git a/test/opt/if_conversion_test.cpp b/test/opt/if_conversion_test.cpp index a62a15e8..ae458eed 100644 --- a/test/opt/if_conversion_test.cpp +++ b/test/opt/if_conversion_test.cpp @@ -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(text, true); } -#endif // SPIRV_EFFCEE TEST_F(IfConversionTest, NoCommonDominator) { const std::string text = R"(OpCapability Shader diff --git a/test/opt/inline_test.cpp b/test/opt/inline_test.cpp index 49e32ac7..f0a376e1 100644 --- a/test/opt/inline_test.cpp +++ b/test/opt/inline_test.cpp @@ -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(text, true); } -#endif // TODO(greg-lunarg): Add tests to verify handling of these cases: // diff --git a/test/opt/ir_builder.cpp b/test/opt/ir_builder.cpp index 7eeb86dd..41d7f57e 100644 --- a/test/opt/ir_builder.cpp +++ b/test/opt/ir_builder.cpp @@ -17,6 +17,7 @@ #include #include +#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 diff --git a/test/opt/local_access_chain_convert_test.cpp b/test/opt/local_access_chain_convert_test.cpp index cb357216..154824b1 100644 --- a/test/opt/local_access_chain_convert_test.cpp +++ b/test/opt/local_access_chain_convert_test.cpp @@ -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(predefs_before + before, true); } -#endif // SPIRV_EFFCEE TEST_F(LocalAccessChainConvertTest, DynamicallyIndexedVarNotConverted) { // #version 140 diff --git a/test/opt/local_redundancy_elimination_test.cpp b/test/opt/local_redundancy_elimination_test.cpp index bdaafb85..bc4635e2 100644 --- a/test/opt/local_redundancy_elimination_test.cpp +++ b/test/opt/local_redundancy_elimination_test.cpp @@ -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(text, false); } -#endif } // namespace } // namespace opt diff --git a/test/opt/local_ssa_elim_test.cpp b/test/opt/local_ssa_elim_test.cpp index 33419395..92a95f14 100644 --- a/test/opt/local_ssa_elim_test.cpp +++ b/test/opt/local_ssa_elim_test.cpp @@ -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(spv_asm, true); } -#endif // TODO(greg-lunarg): Add tests to verify handling of these cases: // diff --git a/test/opt/loop_optimizations/fusion_legal.cpp b/test/opt/loop_optimizations/fusion_legal.cpp index 509516f8..db7f61c6 100644 --- a/test/opt/loop_optimizations/fusion_legal.cpp +++ b/test/opt/loop_optimizations/fusion_legal.cpp @@ -18,15 +18,12 @@ #include #include +#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 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 } /* diff --git a/test/opt/loop_optimizations/fusion_pass.cpp b/test/opt/loop_optimizations/fusion_pass.cpp index 857ada93..94939237 100644 --- a/test/opt/loop_optimizations/fusion_pass.cpp +++ b/test/opt/loop_optimizations/fusion_pass.cpp @@ -14,21 +14,16 @@ #include +#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(text, true, 5); } -#endif - } // namespace } // namespace opt } // namespace spvtools diff --git a/test/opt/loop_optimizations/hoist_without_preheader.cpp b/test/opt/loop_optimizations/hoist_without_preheader.cpp index 9e8d02fa..9a149964 100644 --- a/test/opt/loop_optimizations/hoist_without_preheader.cpp +++ b/test/opt/loop_optimizations/hoist_without_preheader.cpp @@ -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(text, false); } -#endif } // namespace } // namespace opt diff --git a/test/opt/loop_optimizations/lcssa.cpp b/test/opt/loop_optimizations/lcssa.cpp index 22077265..ace6ce19 100644 --- a/test/opt/loop_optimizations/lcssa.cpp +++ b/test/opt/loop_optimizations/lcssa.cpp @@ -16,6 +16,7 @@ #include #include +#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& 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 diff --git a/test/opt/loop_optimizations/peeling.cpp b/test/opt/loop_optimizations/peeling.cpp index e5db20b4..7c6a84ec 100644 --- a/test/opt/loop_optimizations/peeling.cpp +++ b/test/opt/loop_optimizations/peeling.cpp @@ -16,16 +16,13 @@ #include #include +#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 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 } /* diff --git a/test/opt/loop_optimizations/unroll_simple.cpp b/test/opt/loop_optimizations/unroll_simple.cpp index 750af816..f551e7ca 100644 --- a/test/opt/loop_optimizations/unroll_simple.cpp +++ b/test/opt/loop_optimizations/unroll_simple.cpp @@ -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(text, true, kFullyUnroll, kUnrollFactor); } -#endif // SPIRV_EFFCEE } // namespace } // namespace opt diff --git a/test/opt/loop_optimizations/unswitch.cpp b/test/opt/loop_optimizations/unswitch.cpp index 96a7fc01..387178a1 100644 --- a/test/opt/loop_optimizations/unswitch.cpp +++ b/test/opt/loop_optimizations/unswitch.cpp @@ -14,21 +14,16 @@ #include +#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(text, true); } -#endif // SPIRV_EFFCEE /* Generated from the following GLSL + --eliminate-local-multi-store diff --git a/test/opt/pass_fixture.h b/test/opt/pass_fixture.h index 9d9eb366..dee5a5f9 100644 --- a/test/opt/pass_fixture.h +++ b/test/opt/pass_fixture.h @@ -22,6 +22,7 @@ #include #include +#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)...); } -#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 @@ -232,8 +227,8 @@ class PassTest : public TestT { } private: - MessageConsumer consumer_; // Message consumer. - std::unique_ptr context_; // IR context + MessageConsumer consumer_; // Message consumer. + std::unique_ptr context_; // IR context SpirvTools tools_; // An instance for calling SPIRV-Tools functionalities. std::unique_ptr manager_; // The pass manager. uint32_t assemble_options_; diff --git a/test/opt/pass_merge_return_test.cpp b/test/opt/pass_merge_return_test.cpp index 04ac3bf6..c3885de9 100644 --- a/test/opt/pass_merge_return_test.cpp +++ b/test/opt/pass_merge_return_test.cpp @@ -257,7 +257,6 @@ OpFunctionEnd SinglePassRunAndCheck(before, after, false, true); } -#ifdef SPIRV_EFFCEE TEST_F(MergeReturnPassTest, StructuredControlFlowWithUnreachableMerge) { const std::string before = R"( @@ -1019,7 +1018,6 @@ OpFunctionEnd SinglePassRunAndMatch(test, false); } -#endif // SPIRV_EFFCEE } // namespace } // namespace opt diff --git a/test/opt/private_to_local_test.cpp b/test/opt/private_to_local_test.cpp index d7eb37e5..3ec74fae 100644 --- a/test/opt/private_to_local_test.cpp +++ b/test/opt/private_to_local_test.cpp @@ -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(text, false); } -#endif - } // namespace } // namespace opt } // namespace spvtools diff --git a/test/opt/reduce_load_size_test.cpp b/test/opt/reduce_load_size_test.cpp index 1d367e10..50dc5017 100644 --- a/test/opt/reduce_load_size_test.cpp +++ b/test/opt/reduce_load_size_test.cpp @@ -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(test, false); } -#endif TEST_F(ReduceLoadSizeTest, cbuffer_load_extract_vector) { // Originally from the following HLSL: diff --git a/test/opt/redundancy_elimination_test.cpp b/test/opt/redundancy_elimination_test.cpp index a6e8c4f2..7d2abe84 100644 --- a/test/opt/redundancy_elimination_test.cpp +++ b/test/opt/redundancy_elimination_test.cpp @@ -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 diff --git a/test/opt/replace_invalid_opc_test.cpp b/test/opt/replace_invalid_opc_test.cpp index adfe2ee1..ec3cea4a 100644 --- a/test/opt/replace_invalid_opc_test.cpp +++ b/test/opt/replace_invalid_opc_test.cpp @@ -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 diff --git a/test/opt/scalar_replacement_test.cpp b/test/opt/scalar_replacement_test.cpp index 652978bb..8415ef0a 100644 --- a/test/opt/scalar_replacement_test.cpp +++ b/test/opt/scalar_replacement_test.cpp @@ -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(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) { diff --git a/test/opt/simplification_test.cpp b/test/opt/simplification_test.cpp index b5ad2679..b7d6f18c 100644 --- a/test/opt/simplification_test.cpp +++ b/test/opt/simplification_test.cpp @@ -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(text, false); } -#endif - } // namespace } // namespace opt } // namespace spvtools diff --git a/test/opt/strength_reduction_test.cpp b/test/opt/strength_reduction_test.cpp index 654c90df..31d05036 100644 --- a/test/opt/strength_reduction_test.cpp +++ b/test/opt/strength_reduction_test.cpp @@ -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(text, false); } -#endif // Test to make sure we replace a multiple of 32 and 4. TEST_F(StrengthReductionBasicTest, BasicTwoPowersOf2) { diff --git a/test/opt/type_manager_test.cpp b/test/opt/type_manager_test.cpp index cf1fcb58..07a2ac47 100644 --- a/test/opt/type_manager_test.cpp +++ b/test/opt/type_manager_test.cpp @@ -17,6 +17,7 @@ #include #include +#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& 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> GenerateAllTypes() { // Types in this test case are only equal to themselves, nothing else. std::vector> 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 diff --git a/test/opt/vector_dce_test.cpp b/test/opt/vector_dce_test.cpp index 6ad752ab..c19159b0 100644 --- a/test/opt/vector_dce_test.cpp +++ b/test/opt/vector_dce_test.cpp @@ -611,7 +611,6 @@ OpFunctionEnd SinglePassRunAndCheck(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(assembly, true); } -#endif TEST_F(VectorDCETest, VectorIntoCompositeConstruct) { const std::string text = R"(OpCapability Linkage diff --git a/test/opt/workaround1209_test.cpp b/test/opt/workaround1209_test.cpp index 853a01cb..50d3c091 100644 --- a/test/opt/workaround1209_test.cpp +++ b/test/opt/workaround1209_test.cpp @@ -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(text, false); } -#endif } // namespace } // namespace opt