chromium/third_party/dawn/src/tint/lang/wgsl/resolver/uniformity_test.cc

// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// GEN_BUILD:CONDITION(tint_build_wgsl_reader)

#include <memory>
#include <string>
#include <tuple>
#include <utility>

#include "src/tint/lang/wgsl/program/program_builder.h"
#include "src/tint/lang/wgsl/reader/reader.h"
#include "src/tint/lang/wgsl/resolver/resolve.h"
#include "src/tint/lang/wgsl/resolver/uniformity.h"
#include "src/tint/utils/text/string_stream.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace tint::resolver {
namespace {

usingnamespacetint::core::fluent_types;     // NOLINT
usingnamespacetint::core::number_suffixes;  // NOLINT

class UniformityAnalysisTestBase {};

class UniformityAnalysisTest : public UniformityAnalysisTestBase, public ::testing::Test {};

class BasicTest : public UniformityAnalysisTestBase,
                  public ::testing::TestWithParam<std::tuple<int, int>> {};

// Test the uniformity constraints for a function call inside a conditional statement.
TEST_P(BasicTest, ConditionalFunctionCall) {}

INSTANTIATE_TEST_SUITE_P();

////////////////////////////////////////////////////////////////////////////////
/// Test specific function and parameter tags that are not tested above.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, ParameterNoRestriction_Pass) {}

TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniform_Pass) {}

TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniform_Fail) {}

TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForReturnValue_Pass) {}

TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForReturnValue_Fail) {}

////////////////////////////////////////////////////////////////////////////////
/// Test shader IO attributes.
////////////////////////////////////////////////////////////////////////////////

struct BuiltinEntry {};

class ComputeBuiltin : public UniformityAnalysisTestBase,
                       public ::testing::TestWithParam<BuiltinEntry> {};
TEST_P(ComputeBuiltin, AsParam) {}

TEST_P(ComputeBuiltin, InStruct) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(UniformityAnalysisTest, ComputeBuiltin_MixedAttributesInStruct) {}

class FragmentBuiltin : public UniformityAnalysisTestBase,
                        public ::testing::TestWithParam<BuiltinEntry> {};
TEST_P(FragmentBuiltin, AsParam) {}

TEST_P(FragmentBuiltin, InStruct) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(UniformityAnalysisTest, FragmentLocation) {}

TEST_F(UniformityAnalysisTest, FragmentLocation_InStruct) {}

////////////////////////////////////////////////////////////////////////////////
/// Test loop conditions and conditional break/continue statements.
////////////////////////////////////////////////////////////////////////////////

namespace LoopTest {

enum ControlFlowInterrupt {};
enum Condition {};

LoopTestParams;

static std::string ToStr(ControlFlowInterrupt interrupt) {}

static std::string ToStr(Condition condition) {}

class LoopTest : public UniformityAnalysisTestBase,
                 public ::testing::TestWithParam<LoopTestParams> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(LoopTest, CallInBody_InterruptAfter) {}

TEST_P(LoopTest, CallInBody_InterruptBefore) {}

TEST_P(LoopTest, CallInContinuing_InterruptInBody) {}

TEST_F(UniformityAnalysisTest, Loop_CallInBody_UniformBreakInContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_CallInBody_NonUniformBreakInContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_CallInContinuing_UniformBreakInContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_CallInContinuing_NonUniformBreakInContinuing) {}

class LoopDeadCodeTest : public UniformityAnalysisTestBase, public ::testing::TestWithParam<int> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(LoopDeadCodeTest, AfterInterrupt) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInLoopAfterBarrier) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInLoopAfterBarrier_BreakAtEnd) {}

TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithConditionalBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesUniformBeforeSomeExits_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesUniformBeforeAllExits_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Loop_AssignNonUniformBeforeConditionalBreak_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) {}

TEST_F(UniformityAnalysisTest,
       Loop_VarBecomesUniformBeforeConditionalContinue_BarrierInContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformBeforeConditionalContinue) {}

TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInNestedLoopWithBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest,
       Loop_VarBecomesNonUniformInNestedLoopWithBreak_BecomesUniformAgain_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Loop_NonUniformValueNeverReachesContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_NonUniformValueDeclaredInBody_UnreachableContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_NonUniformValueDeclaredInBody_MaybeReachesContinuing) {}

TEST_F(UniformityAnalysisTest, Loop_NonUniformBreakInBody_Reconverge) {}

TEST_F(UniformityAnalysisTest, ForLoop_CallInside_UniformCondition) {}

TEST_F(UniformityAnalysisTest, ForLoop_CallInside_NonUniformCondition) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInContinuing_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesUniformInContinuing_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInContinuing_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesUniformInContinuing_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInLoopAfterBarrier) {}

TEST_F(UniformityAnalysisTest, ForLoop_ConditionalAssignNonUniformWithBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarRemainsNonUniformAtLoopEnd_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest,
       ForLoop_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformBeforeConditionalContinue) {}

TEST_F(UniformityAnalysisTest,
       ForLoop_InitializerVarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) {}

TEST_F(UniformityAnalysisTest, ForLoop_NonUniformCondition_Reconverge) {}

TEST_F(UniformityAnalysisTest, ForLoop_VarDeclaredInBody) {}

TEST_F(UniformityAnalysisTest, ForLoop_InitializerScope) {}

TEST_F(UniformityAnalysisTest, While_CallInside_UniformCondition) {}

TEST_F(UniformityAnalysisTest, While_CallInside_NonUniformCondition) {}

TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformInLoopAfterBarrier) {}

TEST_F(UniformityAnalysisTest, While_ConditionalAssignNonUniformWithBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, While_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, While_VarRemainsNonUniformAtLoopEnd_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) {}

TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformBeforeConditionalContinue) {}

TEST_F(UniformityAnalysisTest, While_NonUniformCondition_Reconverge) {}

}  // namespace LoopTest

////////////////////////////////////////////////////////////////////////////////
/// If-else statement tests.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInTrueBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInElseBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInElseIfBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInTrueBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInElseBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformLHS_And) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformRHS_And) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformLHS_Or) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformRHS_Or) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInElseIfBlock) {}

TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniform_BeforeCondition) {}

TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniform_AfterCondition) {}

TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniformInIf_BarrierInElse) {}

TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformInIf_AssignUniformInElse) {}

TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformInIfWithReturn) {}

TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_BothBranchesAssignUniform) {}

TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_OnlyTrueBranchAssignsUniform) {}

TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_OnlyFalseBranchAssignsUniform) {}

TEST_F(UniformityAnalysisTest,
       IfElse_AssignNonUniformBeforeIf_OnlyTrueBranchAssignsUniform_FalseBranchReturns) {}

TEST_F(UniformityAnalysisTest,
       IfElse_AssignNonUniformBeforeIf_OnlyFalseBranchAssignsUniform_TrueBranchReturns) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_Reconverge) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingNonUniformConditionLHS_Reconverge) {}

TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingNonUniformConditionRHS_Reconverge) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformFunctionCall_Reconverge) {}

TEST_F(UniformityAnalysisTest, IfElse_NonUniformReturn_NoReconverge) {}

////////////////////////////////////////////////////////////////////////////////
/// Switch statement tests.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_BarrierInCase) {}

TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_BarrierInDefault) {}

TEST_F(UniformityAnalysisTest, Switch_NonUniformBreak) {}

TEST_F(UniformityAnalysisTest, Switch_NonUniformBreakInDifferentCase) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesNonUniformInDifferentCase_WithBreak) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInDifferentCase_WithBreak) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesNonUniformInCase_BarrierAfter) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInAllCases_BarrierAfter) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInSomeCases_BarrierAfter) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInCasesThatDontReturn_BarrierAfter) {}

TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformAfterConditionalBreak_BarrierAfter) {}

TEST_F(UniformityAnalysisTest, Switch_NestedInLoop_VarBecomesNonUniformWithBreak_BarrierInLoop) {}

TEST_F(UniformityAnalysisTest, Switch_NestedInLoop_VarBecomesNonUniformWithBreak_BarrierAfterLoop) {}

TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_Reconverge) {}

TEST_F(UniformityAnalysisTest, Switch_NonUniformBreak_Reconverge) {}

////////////////////////////////////////////////////////////////////////////////
/// Pointer tests.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointer) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughPointer) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughCapturedPointer_InNonUniformControlFlow) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughPointer) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformLocalThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformLocalThroughPointerParameter) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformGlobalThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformGlobalThroughPointerParameter) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformGlobalThroughPointerParameter_ViaReturnValue) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughPointerParameter_BecomesUniformAfterUse) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughPointerParameter_BecomesUniformAfterCall) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughPointer) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughPointerParameter) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughNonUniformPointer) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughNonUniformPointer_ViaParameter) {}

TEST_F(UniformityAnalysisTest, LoadUniformThroughNonUniformPointer_ViaParameterChain) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughUniformPointer) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughUniformPointer_ViaParameter) {}

TEST_F(UniformityAnalysisTest, StoreNonUniformAfterCapturingPointer) {}

TEST_F(UniformityAnalysisTest, StoreUniformAfterCapturingPointer) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughLongChainOfPointers) {}

TEST_F(UniformityAnalysisTest, LoadNonUniformThroughLongChainOfPointers) {}

TEST_F(UniformityAnalysisTest, AssignUniformThenNonUniformThroughDifferentPointer) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThenUniformThroughDifferentPointer) {}

TEST_F(UniformityAnalysisTest, UnmodifiedPointerParameterNonUniform) {}

TEST_F(UniformityAnalysisTest, UnmodifiedPointerParameterUniform) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCall) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCall) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallViaArg) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallViaPointerArg) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallViaArg) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallViaPointerArg) {}

TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallChain) {}

TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallChain) {}

TEST_F(UniformityAnalysisTest, MakePointerParamUniformInReturnExpression) {}

TEST_F(UniformityAnalysisTest, MakePointerParamNonUniformInReturnExpression) {}

TEST_F(UniformityAnalysisTest, PointerParamAssignNonUniformInTrueAndUniformInFalse) {}

TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndReturn) {}

TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndBreakFromSwitch) {}

TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndBreakFromLoop) {}

TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndContinue) {}

TEST_F(UniformityAnalysisTest, PointerParamMaybeBecomesUniform) {}

TEST_F(UniformityAnalysisTest, PointerParamModifiedInNonUniformControlFlow) {}

TEST_F(UniformityAnalysisTest, PointerParamAssumedModifiedInNonUniformControlFlow) {}

TEST_F(UniformityAnalysisTest, PointerParamModifiedInNonUniformControlFlow_NestedCall) {}

TEST_F(UniformityAnalysisTest, PointerParamModifiedInUniformControlFlow) {}

TEST_F(UniformityAnalysisTest, NonUniformPointerParameterBecomesUniform_AfterUse) {}

TEST_F(UniformityAnalysisTest, NonUniformPointerParameterBecomesUniform_BeforeUse) {}

TEST_F(UniformityAnalysisTest, UniformPointerParameterBecomesNonUniform_BeforeUse) {}

TEST_F(UniformityAnalysisTest, UniformPointerParameterBecomesNonUniform_AfterUse) {}

TEST_F(UniformityAnalysisTest, NonUniformPointerParameterUpdatedInPlace) {}

TEST_F(UniformityAnalysisTest, MultiplePointerParametersBecomeNonUniform) {}

TEST_F(UniformityAnalysisTest, MultiplePointerParametersWithEdgesToEachOther) {}

TEST_F(UniformityAnalysisTest, MaximumNumberOfPointerParameters) {}

TEST_F(UniformityAnalysisTest, AssignUniformToPrivatePointerParameter_StillNonUniform) {}

TEST_F(UniformityAnalysisTest, AssignUniformToWorkgroupPointerParameter_StillNonUniform) {}

TEST_F(UniformityAnalysisTest, AssignUniformToStoragePointerParameter_StillNonUniform) {}

TEST_F(UniformityAnalysisTest, LoadFromReadOnlyStoragePointerParameter_AlwaysUniform) {}

////////////////////////////////////////////////////////////////////////////////
/// Tests to cover access to aggregate types.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, VectorElement_Uniform) {}

TEST_F(UniformityAnalysisTest, VectorElement_NonUniform) {}

TEST_F(UniformityAnalysisTest, VectorSwizzle_NonUniform) {}

TEST_F(UniformityAnalysisTest, VectorSwizzleFromPointer_NonUniform) {}

TEST_F(UniformityAnalysisTest, VectorElement_BecomesNonUniform_BeforeCondition) {}

TEST_F(UniformityAnalysisTest, VectorElement_BecomesNonUniform_AfterCondition) {}

TEST_F(UniformityAnalysisTest, VectorElement_DifferentElementBecomesNonUniform) {}

TEST_F(UniformityAnalysisTest, VectorElement_ElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, VectorElement_VectorBecomesUniform_FullAssignment) {}

TEST_F(UniformityAnalysisTest, VectorElementViaMember_VectorBecomesUniform_FullAssignment) {}

TEST_F(UniformityAnalysisTest, VectorElement_VectorBecomesUniform_ThroughPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       VectorElement_VectorBecomesUniform_ThroughPointerChain_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       VectorElement_VectorBecomesUniform_ThroughCapturedPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest, VectorElement_VectorBecomesUniform_PartialAssignment) {}

TEST_F(UniformityAnalysisTest,
       VectorElement_VectorBecomesUniform_PartialAssignment_ViaPointerDerefIndex) {}

TEST_F(UniformityAnalysisTest,
       VectorElement_VectorBecomesUniform_PartialAssignment_ViaPointerIndex) {}

TEST_F(UniformityAnalysisTest, VectorElementViaMember_VectorBecomesUniform_PartialAssignment) {}

TEST_F(UniformityAnalysisTest,
       VectorElementViaMember_VectorBecomesUniform_PartialAssignment_ViaPointerDerefDot) {}

TEST_F(UniformityAnalysisTest,
       VectorElementViaMember_VectorBecomesUniform_PartialAssignment_ViaPointerDot) {}

TEST_F(UniformityAnalysisTest, VectorElement_DifferentElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, VectorElement_NonUniform_AnyBuiltin) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ElementBecomesUniform_FullAssignment) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ElementBecomesUniform_ThroughPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ElementBecomesUniform_ThroughPointerChain_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ElementBecomesUniform_ThroughCapturedPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ColumnBecomesUniform) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ColumnBecomesUniform_ThroughPartialPointer) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ColumnBecomesUniform_ThroughPartialPointerChain) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointer) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointer_PointerDerefIndex) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointer_PointerIndex) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointer_PointerDerefDot) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointer_PointerDot) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_ColumnBecomesUniform_ThroughCapturedPartialPointerChain) {}

TEST_F(UniformityAnalysisTest, MatrixElement_ColumnBecomesUniform_ThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, MatrixElement_MatrixBecomesUniform_PartialAssignment) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_MatrixBecomesUniform_PartialAssignment_ThroughPointer) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_MatrixBecomesUniform_PartialAssignment_ThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest,
       MatrixElement_MatrixBecomesUniform_PartialAssignment_ThroughCapturedPointerChain) {}

TEST_F(UniformityAnalysisTest, MatrixElement_DifferentElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, StructMember_Uniform) {}

TEST_F(UniformityAnalysisTest, StructMember_NonUniform) {}

TEST_F(UniformityAnalysisTest, StructMember_BecomesNonUniform_BeforeCondition) {}

TEST_F(UniformityAnalysisTest, StructMember_BecomesNonUniform_AfterCondition) {}

TEST_F(UniformityAnalysisTest, StructMember_DifferentMemberBecomesNonUniform) {}

TEST_F(UniformityAnalysisTest, StructMember_MemberBecomesUniform) {}

TEST_F(UniformityAnalysisTest, StructMember_MemberBecomesUniformThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, StructMember_MemberBecomesUniformThroughPartialPointer) {}

TEST_F(UniformityAnalysisTest, StructMember_MemberBecomesUniformThroughCapturedPartialPointer) {}

TEST_F(UniformityAnalysisTest, StructMember_StructBecomesUniform_FullAssignment) {}

TEST_F(UniformityAnalysisTest, StructMember_StructBecomesUniform_PartialAssignment) {}

TEST_F(UniformityAnalysisTest, StructMember_StructBecomesUniform_FullAssignment_ThroughPointer) {}

TEST_F(UniformityAnalysisTest,
       StructMember_StructBecomesUniform_FullAssignment_ThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest,
       StructMember_StructBecomesUniform_FullAssignment_ThroughCapturedPointerChain) {}

TEST_F(UniformityAnalysisTest, StructMember_StructBecomesUniform_PartialAssignment_ThroughPointer) {}

TEST_F(UniformityAnalysisTest,
       StructMember_StructBecomesUniform_PartialAssignment_ThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest,
       StructMember_StructBecomesUniform_PartialAssignment_ThroughCapturedPointerChain) {}

TEST_F(UniformityAnalysisTest, StructMember_DifferentMemberBecomesUniform) {}

TEST_F(UniformityAnalysisTest, ArrayElement_Uniform) {}

TEST_F(UniformityAnalysisTest, ArrayElement_NonUniform) {}

TEST_F(UniformityAnalysisTest, ArrayElement_BecomesNonUniform_BeforeCondition) {}

TEST_F(UniformityAnalysisTest, ArrayElement_BecomesNonUniform_AfterCondition) {}

TEST_F(UniformityAnalysisTest, ArrayElement_DifferentElementBecomesNonUniform) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_DifferentElementBecomesNonUniformThroughPartialPointer) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_FullAssignment) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_PartialAssignment) {}

TEST_F(UniformityAnalysisTest, ArrayElement_DifferentElementBecomesUniform) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_ThroughPartialPointer) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_ThroughPartialPointerChain) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_ThroughCapturedPartialPointer) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_ElementBecomesUniform_ThroughCapturedPartialPointerChain) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform_ThroughCapturedPointer) {}

TEST_F(UniformityAnalysisTest, ArrayElement_ArrayBecomesUniform_ThroughPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_ArrayBecomesUniform_ThroughPointerChain_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_ArrayBecomesUniform_ThroughCapturedPointer_FullAssignment) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_ArrayBecomesUniform_ThroughCapturedPointerChain_FullAssignment) {}

TEST_F(UniformityAnalysisTest, ArrayElement_AssignUniformToElementWithNonUniformIndex) {}

TEST_F(UniformityAnalysisTest, ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaPointer) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaPointer_ImplicitDeref) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaStoredPointer) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaPointerParameter) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaPointerParameter_ImplicitDeref) {}

TEST_F(UniformityAnalysisTest,
       ArrayElement_AssignUniformToElementWithNonUniformIndex_ViaPartialPointerParameter) {}

////////////////////////////////////////////////////////////////////////////////
/// Miscellaneous statement and expression tests.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, NonUniformDiscard) {}

TEST_F(UniformityAnalysisTest, FunctionReconvergesOnExit) {}

TEST_F(UniformityAnalysisTest, TypeInitializer) {}

TEST_F(UniformityAnalysisTest, Conversion) {}

TEST_F(UniformityAnalysisTest, Bitcast) {}

TEST_F(UniformityAnalysisTest, CompoundAssignment_NonUniformRHS) {}

TEST_F(UniformityAnalysisTest, CompoundAssignment_UniformRHS_StillNonUniform) {}

TEST_F(UniformityAnalysisTest, CompoundAssignment_Global) {}

TEST_F(UniformityAnalysisTest, IncDec_StillNonUniform) {}

TEST_F(UniformityAnalysisTest, IncDec_Global) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHS_Then_RHS_Pass) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHS_Then_RHS_Fail) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHSContainsViolation) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHSContainsViolation_ViaExplicitDeref) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHSContainsViolation_ViaPointerArrayIndex) {}

TEST_F(UniformityAnalysisTest, AssignmentEval_LHSContainsViolation_ViaPointerMemberAccessor) {}

TEST_F(UniformityAnalysisTest, CompoundAssignmentEval_LHS_Then_RHS_Pass) {}

TEST_F(UniformityAnalysisTest, CompoundAssignmentEval_LHS_Then_RHS_Fail) {}

TEST_F(UniformityAnalysisTest, CompoundAssignmentEval_RHS_Makes_LHS_NonUniform_After_Load) {}

TEST_F(UniformityAnalysisTest, CompoundAssignmentEval_RHS_Makes_LHS_Uniform_After_Load) {}

TEST_F(UniformityAnalysisTest, CompoundAssignmentEval_LHS_OnlyOnce) {}

TEST_F(UniformityAnalysisTest, IncDec_LHS_OnlyOnce) {}

TEST_F(UniformityAnalysisTest, ShortCircuiting_UniformLHS) {}

TEST_F(UniformityAnalysisTest, ShortCircuiting_NonUniformLHS) {}

TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeLHS) {}

TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeRHS) {}

TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeBoth) {}

TEST_F(UniformityAnalysisTest, DeadCode_AfterReturn) {}

TEST_F(UniformityAnalysisTest, ArrayLength) {}

TEST_F(UniformityAnalysisTest, ArrayLength_OnPtrArg) {}

TEST_F(UniformityAnalysisTest, ArrayLength_PtrArgRequiredToBeUniformForRetval_Pass) {}

// TODO(jrprice): This test requires variable pointers.
TEST_F(UniformityAnalysisTest, DISABLED_ArrayLength_PtrArgRequiredToBeUniformForRetval_Fail) {}

TEST_F(UniformityAnalysisTest, ArrayLength_PtrArgRequiredToBeUniformForOtherPtrResult_Pass) {}

// TODO(jrprice): This test requires variable pointers.
TEST_F(UniformityAnalysisTest,
       DISABLED_ArrayLength_PtrArgRequiredToBeUniformForOtherPtrResult_Fail) {}

TEST_F(UniformityAnalysisTest, ArrayLength_PtrArgRequiresUniformityAndAffectsReturnValue) {}

TEST_F(UniformityAnalysisTest, WorkgroupUniformLoad) {}

TEST_F(UniformityAnalysisTest, WorkgroupUniformLoad_ViaPtrArg) {}

TEST_F(UniformityAnalysisTest, WorkgroupUniformLoad_NonUniformPtr) {}

TEST_F(UniformityAnalysisTest, WorkgroupUniformLoad_NonUniformPtr_ViaPtrArg) {}

TEST_F(UniformityAnalysisTest, WorkgroupAtomics) {}

TEST_F(UniformityAnalysisTest, StorageAtomics) {}

TEST_F(UniformityAnalysisTest, StorageTextureLoad_ReadOnly) {}

TEST_F(UniformityAnalysisTest, StorageTextureLoad_ReadWrite) {}

TEST_F(UniformityAnalysisTest, DisableAnalysisWithExtension) {}

TEST_F(UniformityAnalysisTest, StressGraphTraversalDepth) {}

////////////////////////////////////////////////////////////////////////////////
/// Tests for the derivative_uniformity diagnostic filter.
////////////////////////////////////////////////////////////////////////////////

class UniformityAnalysisDiagnosticFilterTest
    : public UniformityAnalysisTestBase,
      public ::testing::TestWithParam<wgsl::DiagnosticSeverity> {};

TEST_P(UniformityAnalysisDiagnosticFilterTest, Directive) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnFunction) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnBlock) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInInitializer) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInCondition) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInIncrement) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInCondition) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInElse) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopStatement_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopStatement_CallInContinuing) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopBody_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopBody_CallInContinuing) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopContinuing_CallInContinuing) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchStatement_CallInCondition) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchStatement_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchBody_CallInBody) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnWhileStatement_CallInCondition) {}

TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnWhileStatement_CallInBody) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(UniformityAnalysisDiagnosticFilterTest, AttributeOnFunction_CalledByAnotherFunction) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest, AttributeOnFunction_RequirementOnParameter) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest, AttributeOnFunction_BuiltinInChildCall) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest, MixOfGlobalAndLocalFilters) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest, BuiltinReturnValueNotAffected) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest,
       ParameterRequiredToBeUniform_With_ParameterRequiredToBeUniformForReturnValue) {}

TEST_F(UniformityAnalysisDiagnosticFilterTest, BarriersNotAffected) {}

////////////////////////////////////////////////////////////////////////////////
/// Tests for the quality of the error messages produced by the analysis.
////////////////////////////////////////////////////////////////////////////////

TEST_F(UniformityAnalysisTest, Error_CallUserThatCallsBuiltinDirectly) {}

TEST_F(UniformityAnalysisTest, Error_CallUserThatCallsBuiltinIndirectly) {}

TEST_F(UniformityAnalysisTest, Error_ParametersRequireUniformityInChain) {}

TEST_F(UniformityAnalysisTest, Error_ReturnValueMayBeNonUniformChain) {}

TEST_F(UniformityAnalysisTest, Error_CallsiteAndParameterRequireUniformity) {}

TEST_F(UniformityAnalysisTest, Error_PointerParameterContentsRequiresUniformity_AfterControlFlow) {}

}  // namespace
}  // namespace tint::resolver