95b8f52f9f
Updates the simplification of moving constat operands of comparisons to the right to correctly use the strictly swapped operand rather than the negated operand. Also change the `flipOperands` function to a `swapped` getter to avoid confusion and be clearer that it returns a new value, rather than changing the current one. This better aligns with the Effective Dart guidelines for when to use a getter and how to name them. TEST=pkg/cfg/testcases/simplification.dart Change-Id: Id2c19b7cfcbc1586413251b2b9d6d54abcf590c0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509840 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Slava Egorov <vegorov@google.com>
268 lines
6.1 KiB
Plaintext
268 lines
6.1 KiB
Plaintext
--- constantFoldInt
|
|
B0 = EntryBlock()
|
|
v1 = Constant(100)
|
|
Constant(24)
|
|
v96 = Constant(null)
|
|
v98 = Constant(124)
|
|
v99 = Constant(76)
|
|
v100 = Constant(2400)
|
|
v101 = Constant(4)
|
|
v102 = Constant(100.0)
|
|
Constant(24.0)
|
|
v104 = Constant(4.166666666666667)
|
|
v105 = Constant(0)
|
|
v106 = Constant(false)
|
|
v107 = Constant(true)
|
|
v108 = Constant(1677721600)
|
|
v109 = Constant(-100)
|
|
v110 = Constant(1099511627775)
|
|
v111 = Constant(-101)
|
|
v112 = Constant(1)
|
|
DirectCall print(v98)
|
|
DirectCall print(v99)
|
|
DirectCall print(v100)
|
|
DirectCall print(v101)
|
|
DirectCall print(v101)
|
|
DirectCall print(v101)
|
|
DirectCall print(v104)
|
|
DirectCall print(v98)
|
|
DirectCall print(v105)
|
|
DirectCall print(v98)
|
|
DirectCall print(v106)
|
|
DirectCall print(v107)
|
|
DirectCall print(v107)
|
|
DirectCall print(v106)
|
|
DirectCall print(v106)
|
|
DirectCall print(v108)
|
|
DirectCall print(v105)
|
|
DirectCall print(v110)
|
|
DirectCall print(v109)
|
|
DirectCall print(v111)
|
|
DirectCall print(v102)
|
|
DirectCall print(v1)
|
|
DirectCall print(v112)
|
|
Return(v96)
|
|
|
|
--- constantFoldDouble
|
|
B0 = EntryBlock()
|
|
v1 = Constant(4.0)
|
|
Constant(0.5)
|
|
v5 = Constant(NaN)
|
|
v90 = Constant(null)
|
|
v92 = Constant(4.5)
|
|
v93 = Constant(3.5)
|
|
v94 = Constant(2.0)
|
|
v95 = Constant(8)
|
|
v96 = Constant(0.0)
|
|
v97 = Constant(8.0)
|
|
v98 = Constant(false)
|
|
v99 = Constant(true)
|
|
v100 = Constant(-4.0)
|
|
v101 = Constant(4)
|
|
v102 = Constant(1.0)
|
|
v103 = Constant(1)
|
|
v104 = Constant(-4)
|
|
Constant(-0.5)
|
|
v106 = Constant(-0.0)
|
|
DirectCall print(v92)
|
|
DirectCall print(v5)
|
|
DirectCall print(v93)
|
|
DirectCall print(v94)
|
|
DirectCall print(v95)
|
|
DirectCall print(v96)
|
|
DirectCall print(v96)
|
|
DirectCall print(v97)
|
|
DirectCall print(v98)
|
|
DirectCall print(v98)
|
|
DirectCall print(v99)
|
|
DirectCall print(v98)
|
|
DirectCall print(v99)
|
|
DirectCall print(v98)
|
|
DirectCall print(v98)
|
|
DirectCall print(v100)
|
|
DirectCall print(v101)
|
|
DirectCall print(v102)
|
|
DirectCall print(v103)
|
|
DirectCall print(v1)
|
|
DirectCall print(v104)
|
|
DirectCall print(v106)
|
|
Return(v90)
|
|
|
|
--- moveConstantToRight
|
|
B0 = EntryBlock()
|
|
v4 = Constant(2)
|
|
v8 = Constant(3)
|
|
v12 = Constant(4)
|
|
v16 = Constant(5)
|
|
v20 = Constant(6)
|
|
v24 = Constant(7)
|
|
v28 = Constant(8)
|
|
v56 = Constant(null)
|
|
v60 = Constant(2.0)
|
|
v61 = Constant(3.0)
|
|
v1 = Parameter(x)
|
|
v2 = Parameter(y)
|
|
v3 = Parameter(obj)
|
|
v6 = BinaryIntOp +(v1, v4)
|
|
DirectCall print(v6)
|
|
v10 = BinaryIntOp *(v1, v8)
|
|
DirectCall print(v10)
|
|
v14 = Comparison int ==(v1, v12)
|
|
DirectCall print(v14)
|
|
v18 = Comparison int <(v1, v16)
|
|
DirectCall print(v18)
|
|
v22 = Comparison int <=(v1, v20)
|
|
DirectCall print(v22)
|
|
v26 = Comparison int >(v1, v24)
|
|
DirectCall print(v26)
|
|
v30 = Comparison int >=(v1, v28)
|
|
DirectCall print(v30)
|
|
v34 = BinaryDoubleOp +(v2, v60)
|
|
DirectCall print(v34)
|
|
v38 = BinaryDoubleOp *(v2, v61)
|
|
DirectCall print(v38)
|
|
v41 = InterfaceCall num.==(v12, v2)
|
|
DirectCall print(v41)
|
|
v44 = InterfaceCall num.>(v16, v2)
|
|
DirectCall print(v44)
|
|
v47 = InterfaceCall num.>=(v20, v2)
|
|
DirectCall print(v47)
|
|
v50 = InterfaceCall num.<(v24, v2)
|
|
DirectCall print(v50)
|
|
v53 = InterfaceCall num.<=(v28, v2)
|
|
DirectCall print(v53)
|
|
v57 = Comparison ==(v3, v56)
|
|
DirectCall print(v57)
|
|
Return(v56)
|
|
|
|
--- arithmeticPatterns
|
|
B0 = EntryBlock()
|
|
v3 = Constant(0)
|
|
Constant(1)
|
|
Constant(16)
|
|
Constant(32)
|
|
Constant(65)
|
|
Constant(1.0)
|
|
v80 = Constant(null)
|
|
v83 = Constant(4)
|
|
v85 = Constant(63)
|
|
v87 = Constant(31)
|
|
v90 = Constant(5)
|
|
v92 = Constant(-1)
|
|
v1 = Parameter(x)
|
|
v2 = Parameter(y)
|
|
DirectCall print(v1)
|
|
v82 = UnaryIntOp -(v1)
|
|
DirectCall print(v82)
|
|
DirectCall print(v1)
|
|
DirectCall print(v3)
|
|
v84 = BinaryIntOp <<(v1, v83)
|
|
DirectCall print(v84)
|
|
v86 = BinaryIntOp >>(v1, v85)
|
|
v88 = BinaryIntOp &(v86, v87)
|
|
v89 = BinaryIntOp +(v1, v88)
|
|
v91 = BinaryIntOp >>(v89, v90)
|
|
DirectCall print(v91)
|
|
DirectCall print(v82)
|
|
DirectCall print(v3)
|
|
v34 = BinaryIntOp >>(v1, v85)
|
|
DirectCall print(v34)
|
|
DirectCall print(v3)
|
|
DirectCall print(v1)
|
|
DirectCall print(v92)
|
|
DirectCall print(v1)
|
|
DirectCall print(v3)
|
|
DirectCall print(v1)
|
|
DirectCall print(v1)
|
|
DirectCall print(v1)
|
|
v94 = UnaryIntOp ~(v1)
|
|
DirectCall print(v94)
|
|
DirectCall print(v3)
|
|
DirectCall print(v2)
|
|
v95 = UnaryDoubleOp square(v2)
|
|
DirectCall print(v95)
|
|
Return(v80)
|
|
|
|
--- redundantPhi
|
|
B0 = EntryBlock()
|
|
v3 = Constant(0)
|
|
v16 = Constant(null)
|
|
v1 = Parameter(x)
|
|
Comparison int >(v1, v3)
|
|
DirectCall print(v1)
|
|
Return(v16)
|
|
|
|
--- stringInterpolation
|
|
B0 = EntryBlock()
|
|
v2 = Constant("")
|
|
Constant("string")
|
|
Constant(42)
|
|
Constant(3.14)
|
|
Constant(true)
|
|
v12 = Constant(null)
|
|
Constant("Hey, ")
|
|
Constant("! i=")
|
|
Constant(", d=")
|
|
Constant(", b=")
|
|
Constant(", n=")
|
|
Constant("enclosing start... ")
|
|
Constant("some nested ")
|
|
Constant(", x=")
|
|
v35 = Constant(" ...end")
|
|
v40 = Constant("Hey, string! i=42, d=3.14, b=true, n=null")
|
|
Constant("some nested string, x=")
|
|
v44 = Constant("enclosing start... some nested string, x=")
|
|
v1 = Parameter(x)
|
|
DirectCall print(v2)
|
|
DirectCall print(v40)
|
|
v43 = StringInterpolation(v44, v1, v35)
|
|
DirectCall print(v43)
|
|
Return(v12)
|
|
|
|
--- stringInterpolation2
|
|
B0 = EntryBlock()
|
|
v3 = Constant(0)
|
|
v6 = Constant(1)
|
|
Constant("prefix1:")
|
|
Constant("prefix2:")
|
|
Constant("A very very looooooooooooooooooooooooooooong prefix: ")
|
|
Constant("'")
|
|
Constant("', not '")
|
|
v23 = Constant("'.")
|
|
v26 = Constant(null)
|
|
v29 = Constant("A very very looooooooooooooooooooooooooooong prefix: 'prefix1:")
|
|
v30 = Constant("', not 'prefix2:")
|
|
v1 = Parameter(x)
|
|
v4 = InterfaceCall List.[](v1, v3)
|
|
v7 = InterfaceCall List.[](v1, v6)
|
|
v8 = StringInterpolation(v4, v7)
|
|
v28 = StringInterpolation(v29, v8, v30, v8, v23)
|
|
DirectCall print(v28)
|
|
Return(v26)
|
|
|
|
--- closureCall
|
|
B0 = EntryBlock()
|
|
v4 = Constant(42)
|
|
v6 = Constant(null)
|
|
v1 = AllocateClosure()
|
|
DirectCall closure FunctionExpression(Null (int arg) {
|
|
print(arg);
|
|
}) at closureCall(v1, v4)
|
|
Return(v6)
|
|
|
|
--- closure FunctionExpression(Null (int arg) {
|
|
print(arg);
|
|
}) at closureCall
|
|
B0 = EntryBlock()
|
|
v5 = Constant(null)
|
|
Parameter(#closure)
|
|
v2 = Parameter(arg)
|
|
DirectCall print(v2)
|
|
Return(v5)
|
|
|
|
--- main
|
|
B0 = EntryBlock()
|
|
v1 = Constant(null)
|
|
Return(v1)
|
|
|