Add additional examples to UnusedVariables test.

`increment` and `float a` could be eliminated, but are not.
This is fixed in a followup CL.

Change-Id: I7a5c3ab7341f40020f84f157b08a7152bc067af0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/resources/sksl/shared/UnusedVariables.sksl b/resources/sksl/shared/UnusedVariables.sksl
index 0134511..8bc675c 100644
--- a/resources/sksl/shared/UnusedVariables.sksl
+++ b/resources/sksl/shared/UnusedVariables.sksl
@@ -1,5 +1,16 @@
+void increment(inout float a, inout float b, inout float c) {
+    a++, b++, c++;
+}
+
 half4 main(float2 coords) {
     float a = 1, b = 2, c = 3;
+    if (false) {
+        a++, b++, c++;
+    }
+    for (int x=0; x<1; ++x) {
+        break;
+        increment(a, b, c);
+    }
     float d = c;
     float e = d;
     b++;
diff --git a/tests/sksl/shared/UnusedVariables.asm.frag b/tests/sksl/shared/UnusedVariables.asm.frag
index bb71242..fd1b0b6 100644
--- a/tests/sksl/shared/UnusedVariables.asm.frag
+++ b/tests/sksl/shared/UnusedVariables.asm.frag
@@ -6,19 +6,22 @@
 OpName %sk_FragColor "sk_FragColor"
 OpName %sk_Clockwise "sk_Clockwise"
 OpName %_entrypoint_v "_entrypoint_v"
+OpName %increment_vfff "increment_vfff"
 OpName %main "main"
+OpName %a "a"
 OpName %b "b"
 OpName %c "c"
+OpName %x "x"
 OpName %d "d"
 OpDecorate %sk_FragColor RelaxedPrecision
 OpDecorate %sk_FragColor Location 0
 OpDecorate %sk_FragColor Index 0
 OpDecorate %sk_Clockwise BuiltIn FrontFacing
-OpDecorate %37 RelaxedPrecision
-OpDecorate %40 RelaxedPrecision
-OpDecorate %44 RelaxedPrecision
-OpDecorate %48 RelaxedPrecision
-OpDecorate %49 RelaxedPrecision
+OpDecorate %64 RelaxedPrecision
+OpDecorate %67 RelaxedPrecision
+OpDecorate %71 RelaxedPrecision
+OpDecorate %75 RelaxedPrecision
+OpDecorate %76 RelaxedPrecision
 %float = OpTypeFloat 32
 %v4float = OpTypeVector %float 4
 %_ptr_Output_v4float = OpTypePointer Output %v4float
@@ -27,54 +30,95 @@
 %_ptr_Input_bool = OpTypePointer Input %bool
 %sk_Clockwise = OpVariable %_ptr_Input_bool Input
 %void = OpTypeVoid
-%12 = OpTypeFunction %void
+%13 = OpTypeFunction %void
 %v2float = OpTypeVector %float 2
 %float_0 = OpConstant %float 0
-%16 = OpConstantComposite %v2float %float_0 %float_0
+%17 = OpConstantComposite %v2float %float_0 %float_0
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-%20 = OpTypeFunction %v4float %_ptr_Function_v2float
 %_ptr_Function_float = OpTypePointer Function %float
+%21 = OpTypeFunction %void %_ptr_Function_float %_ptr_Function_float %_ptr_Function_float
+%float_1 = OpConstant %float 1
+%34 = OpTypeFunction %v4float %_ptr_Function_v2float
 %float_2 = OpConstant %float 2
 %float_3 = OpConstant %float 3
-%float_1 = OpConstant %float 1
+%int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
 %float_5 = OpConstant %float 5
 %float_4 = OpConstant %float 4
-%_entrypoint_v = OpFunction %void None %12
-%13 = OpLabel
-%17 = OpVariable %_ptr_Function_v2float Function
-OpStore %17 %16
-%19 = OpFunctionCall %v4float %main %17
-OpStore %sk_FragColor %19
+%_entrypoint_v = OpFunction %void None %13
+%14 = OpLabel
+%18 = OpVariable %_ptr_Function_v2float Function
+OpStore %18 %17
+%20 = OpFunctionCall %v4float %main %18
+OpStore %sk_FragColor %20
 OpReturn
 OpFunctionEnd
-%main = OpFunction %v4float None %20
-%21 = OpFunctionParameter %_ptr_Function_v2float
-%22 = OpLabel
+%increment_vfff = OpFunction %void None %21
+%23 = OpFunctionParameter %_ptr_Function_float
+%24 = OpFunctionParameter %_ptr_Function_float
+%25 = OpFunctionParameter %_ptr_Function_float
+%26 = OpLabel
+%27 = OpLoad %float %23
+%29 = OpFAdd %float %27 %float_1
+OpStore %23 %29
+%30 = OpLoad %float %24
+%31 = OpFAdd %float %30 %float_1
+OpStore %24 %31
+%32 = OpLoad %float %25
+%33 = OpFAdd %float %32 %float_1
+OpStore %25 %33
+OpReturn
+OpFunctionEnd
+%main = OpFunction %v4float None %34
+%35 = OpFunctionParameter %_ptr_Function_v2float
+%36 = OpLabel
+%a = OpVariable %_ptr_Function_float Function
 %b = OpVariable %_ptr_Function_float Function
 %c = OpVariable %_ptr_Function_float Function
+%x = OpVariable %_ptr_Function_int Function
 %d = OpVariable %_ptr_Function_float Function
+OpStore %a %float_1
 OpStore %b %float_2
 OpStore %c %float_3
-%29 = OpLoad %float %c
-OpStore %d %29
-%30 = OpLoad %float %b
-%32 = OpFAdd %float %30 %float_1
-OpStore %b %32
-%33 = OpLoad %float %d
-%34 = OpFAdd %float %33 %float_1
-OpStore %d %34
-%35 = OpLoad %float %b
-%36 = OpFOrdEqual %bool %35 %float_2
-%37 = OpSelect %float %36 %float_1 %float_0
-%38 = OpLoad %float %b
-%39 = OpFOrdEqual %bool %38 %float_3
-%40 = OpSelect %float %39 %float_1 %float_0
-%41 = OpLoad %float %d
-%43 = OpFOrdEqual %bool %41 %float_5
-%44 = OpSelect %float %43 %float_1 %float_0
-%45 = OpLoad %float %d
-%47 = OpFOrdEqual %bool %45 %float_4
-%48 = OpSelect %float %47 %float_1 %float_0
-%49 = OpCompositeConstruct %v4float %37 %40 %44 %48
-OpReturnValue %49
+OpStore %x %int_0
+OpBranch %46
+%46 = OpLabel
+OpLoopMerge %50 %49 None
+OpBranch %47
+%47 = OpLabel
+%51 = OpLoad %int %x
+%53 = OpSLessThan %bool %51 %int_1
+OpBranchConditional %53 %48 %50
+%48 = OpLabel
+OpBranch %50
+%49 = OpLabel
+%54 = OpLoad %int %x
+%55 = OpIAdd %int %54 %int_1
+OpStore %x %55
+OpBranch %46
+%50 = OpLabel
+%57 = OpLoad %float %c
+OpStore %d %57
+%58 = OpLoad %float %b
+%59 = OpFAdd %float %58 %float_1
+OpStore %b %59
+%60 = OpLoad %float %d
+%61 = OpFAdd %float %60 %float_1
+OpStore %d %61
+%62 = OpLoad %float %b
+%63 = OpFOrdEqual %bool %62 %float_2
+%64 = OpSelect %float %63 %float_1 %float_0
+%65 = OpLoad %float %b
+%66 = OpFOrdEqual %bool %65 %float_3
+%67 = OpSelect %float %66 %float_1 %float_0
+%68 = OpLoad %float %d
+%70 = OpFOrdEqual %bool %68 %float_5
+%71 = OpSelect %float %70 %float_1 %float_0
+%72 = OpLoad %float %d
+%74 = OpFOrdEqual %bool %72 %float_4
+%75 = OpSelect %float %74 %float_1 %float_0
+%76 = OpCompositeConstruct %v4float %64 %67 %71 %75
+OpReturnValue %76
 OpFunctionEnd
diff --git a/tests/sksl/shared/UnusedVariables.glsl b/tests/sksl/shared/UnusedVariables.glsl
index 2b72aff..1de6257 100644
--- a/tests/sksl/shared/UnusedVariables.glsl
+++ b/tests/sksl/shared/UnusedVariables.glsl
@@ -1,8 +1,15 @@
 
 out vec4 sk_FragColor;
+void increment_vfff(inout float a, inout float b, inout float c) {
+    ((a++ , b++) , c++);
+}
 vec4 main() {
+    float a = 1.0;
     float b = 2.0;
     float c = 3.0;
+    for (int x = 0;x < 1; ++x) {
+        break;
+    }
     float d = c;
     b++;
     d++;
diff --git a/tests/sksl/shared/UnusedVariables.metal b/tests/sksl/shared/UnusedVariables.metal
index f8d5c51..e62a3da 100644
--- a/tests/sksl/shared/UnusedVariables.metal
+++ b/tests/sksl/shared/UnusedVariables.metal
@@ -6,11 +6,18 @@
 struct Outputs {
     float4 sk_FragColor [[color(0)]];
 };
+void increment_vfff(thread float& a, thread float& b, thread float& c) {
+    ((a++ , b++) , c++);
+}
 fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
     Outputs _out;
     (void)_out;
+    float a = 1.0;
     float b = 2.0;
     float c = 3.0;
+    for (int x = 0;x < 1; ++x) {
+        break;
+    }
     float d = c;
     b++;
     d++;