Check-in [4f50ed77b2]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Stop constant folding from leaving dead code behind, Add a test for simple nested iterations, using [lmap]. Temporarily patch 'foreach' operations from being hoistable - I don't think this will be necessary, but it's tickling other bugs. Make translation of values across a phi work if one of the inputs to the phi is a literal. Put 'bbidom' and 'bblevel' directly after dead code elimination, because virtually everything depends on having dominators, which deadcode destroys.
Timelines: family | ancestors | descendants | both | notworking | kbk-pre
Files: files | file ages | folders
SHA3-256: 4f50ed77b2f1057471b76368f54a0484e6eda5047d869b7a808c67db07a0f803
User & Date: kbk 2018-12-03 05:08:03.717
Context
2018-12-05
05:37
Rewrite pre_insert and pre_phi_translate to NOT use a persistent cache. The missing piece in VanD04 is that pre_insert must call pre_phi_translate for all the anticipated expressions first, and then use the dictionary that results for the translated values. There are still further bugs, but we're over this hump at least. check-in: 0bbe5a5dd3 user: kbk tags: notworking, kbk-pre
2018-12-03
05:08
Stop constant folding from leaving dead code behind, Add a test for simple nested iterations, using [lmap]. Temporarily patch 'foreach' operations from being hoistable - I don't think this will be necessary, but it's tickling other bugs. Make translation of values across a phi work if one of the inputs to the phi is a literal. Put 'bbidom' and 'bblevel' directly after dead code elimination, because virtually everything depends on having dominators, which deadcode destroys. check-in: 4f50ed77b2 user: kbk tags: notworking, kbk-pre
01:06
Fix crashing bug in creating variable name for a phi operation. Fix bug where partial redundancy elimination got stale dominators, causing much weirdness. Add additional tracing to available expression calculation. check-in: ce1088b7a7 user: kbk tags: notworking, kbk-pre
Changes
Unified Diff Ignore Whitespace Patch
Changes to demos/perftest/tester.tcl.
77
78
79
80
81
82
83






84
85
86
87
88
89
90
proc polartest {u v} {
    set th [expr {atan2($v,$u)}]
    set r [expr {hypot($v,$u)}]
    set u2 [expr {$r * cos($th)}]
    set v2 [expr {$r * sin($th)}]
    return [expr {hypot($v2-$v, $u2-$u)}]
}







# This is a cut-down version of the version in Tcllib's math package
namespace eval math {}
proc ::math::ln_Gamma { x } {

    # Handle the common case of a real argument that's within the
    # permissible range.







>
>
>
>
>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
proc polartest {u v} {
    set th [expr {atan2($v,$u)}]
    set r [expr {hypot($v,$u)}]
    set u2 [expr {$r * cos($th)}]
    set v2 [expr {$r * sin($th)}]
    return [expr {hypot($v2-$v, $u2-$u)}]
}

proc lmapconsttest {} {
    lmap y {10 20 30} {
	lmap x {1 2 3} {expr {$x + $y}}
    }
}

# This is a cut-down version of the version in Tcllib's math package
namespace eval math {}
proc ::math::ln_Gamma { x } {

    # Handle the common case of a real argument that's within the
    # permissible range.
2051
2052
2053
2054
2055
2056
2057

2058
2059
2060
2061
2062
2063
2064
    {fib 85}
    {fib-r 15}
    {cos 1.2}
    # Fails on a roundoff error: {tantest 1.2}
    {inttest 345}
    {math::ln_Gamma 1.3}
    {polartest 0.6 0.8}

    {powmul1 13 3}
    {powmul2 13 3}
    {zerodiv}
    {uplustest 123 456}
    {uplustest 01 010}
    {cleanopt {uplustest abc def}}
    # String operations







>







2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
    {fib 85}
    {fib-r 15}
    {cos 1.2}
    # Fails on a roundoff error: {tantest 1.2}
    {inttest 345}
    {math::ln_Gamma 1.3}
    {polartest 0.6 0.8}
    {lmapconsttest}
    {powmul1 13 3}
    {powmul2 13 3}
    {zerodiv}
    {uplustest 123 456}
    {uplustest 01 010}
    {cleanopt {uplustest abc def}}
    # String operations
2365
2366
2367
2368
2369
2370
2371

2372
2373
2374
2375
2376
2377
2378
    # heavily, the others are less critical
    fib fib-r
    ::cos
    tantest
    inttest
    math::ln_Gamma
    polartest

    shift
    powmul1 powmul2
    zerodiv
    uplustest
    # String operations
    strtest
    passthrough







>







2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
    # heavily, the others are less critical
    fib fib-r
    ::cos
    tantest
    inttest
    math::ln_Gamma
    polartest
    lmapconsttest
    shift
    powmul1 powmul2
    zerodiv
    uplustest
    # String operations
    strtest
    passthrough
Changes to quadcode/constfold.tcl.
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
    # Walk through basic blocks in forward sequence.

    for {set b 0} {$b < [llength $bbcontent]} {incr b} {
	set newbb {}
	set newpc -1
	for {set pc 0} {$pc < [llength [lindex $bbcontent $b]]} {incr pc} {
	    set q [lindex $bbcontent $b $pc]

	    set mightfold 1
	    set argl {}
	    foreach arg [lrange $q 2 end] {
		if {[lindex $arg 0] ne "literal"} {
		    set mightfold 0
		    break
		}
		lappend argl [lindex $arg 1]
	    }

	    if {$mightfold} {

		switch -exact -- [lindex $q 0 0] {

		    "@debug-file" - "@debug-context" -
		    "@debug-line" - "@debug-script" -
		    "dictIterStart" - "directAppend" - "directArrayAppend" -







>









>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    # Walk through basic blocks in forward sequence.

    for {set b 0} {$b < [llength $bbcontent]} {incr b} {
	set newbb {}
	set newpc -1
	for {set pc 0} {$pc < [llength [lindex $bbcontent $b]]} {incr pc} {
	    set q [lindex $bbcontent $b $pc]
	    lset bbcontent $b $pc [list nop {}]
	    set mightfold 1
	    set argl {}
	    foreach arg [lrange $q 2 end] {
		if {[lindex $arg 0] ne "literal"} {
		    set mightfold 0
		    break
		}
		lappend argl [lindex $arg 1]
	    }
	    set result [lindex $q 1]
	    if {$mightfold} {

		switch -exact -- [lindex $q 0 0] {

		    "@debug-file" - "@debug-context" -
		    "@debug-line" - "@debug-script" -
		    "dictIterStart" - "directAppend" - "directArrayAppend" -
78
79
80
81
82
83
84
85
86

87
88

89
90
91
92
93
94
95
		    }

		    "add" {
			lassign $argl x y
			set res [list literal [expr {$x + $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "arrayExists" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}








|

>
|

>







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
		    }

		    "add" {
			lassign $argl x y
			set res [list literal [expr {$x + $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "arrayExists" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}

105
106
107
108
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128
129
130

131
132

133
134
135
136
137
138
139
140
141

142
143

144
145
146
147
148
149
150
151
152

153
154

155
156
157
158
159
160
161
162
163

164
165

166
167
168
169
170
171
172
173
174

175
176

177
178
179
180
181
182
183
184
185
186
187
188
189
190

191
192

193
194
195
196
197
198
199
200
201
202

203
204

205
206
207
208
209
210
211
212
213
214

215
216

217
218
219
220
221
222
223
224
225
226
227

228
229

230
231
232
233
234
235
236
237
238
239
240
241
242
243

244
245

246
247
248
249
250
251
252
253
254
255

256
257

258
259
260
261
262
263
264
265

266
267

268
269
270
271
272
273
274
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement {literal 1}
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement {literal 0}
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace [lindex $q 1] with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b
			    my replaceUses [lindex $q 1] $replacement
			    dict unset udchain [lindex $q 1]

			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "bitand" {
			lassign $argl x y
			set res [list literal [expr {$x & $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "bitnot" {
			lassign $argl x
			set res [list literal [expr {~$x}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "bitor" {
			lassign $argl x y
			set res [list literal [expr {$x | $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "bitxor" {
			lassign $argl x y
			set res [list literal [expr {$x ^ $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "copy" {
			lassign $argl res
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "dictExists" {
			set argl [lassign $argl d]
			if {[llength $argl] == 0} {
			    set res 0
			} else {
			    set res [dict exists $d {*}[lreverse $argl]]
			}
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "dictGet" - "dictGetOrNexist" {
			set argl [lassign $argl d]
			set res [dict get $d {*}[lreverse $argl]]
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "dictIncr" {
			set argl [lassign $argl res]
			dict incr res {*}$argl
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }


		    "dictSet" - "dictSetOrUnset" {
			set argl [lassign $argl d]
			dict set d {*}[lreverse $argl]
			set res [list literal $d]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "div" {
			lassign $argl x y
			if {[catch {expr {$x / $y}} res]} {
			    my diagnostic warning $b $pc \
				"expression will divide by zero at run time"
			    lset bbcontent $b [incr newpc] $q
			} else {
			    set res [list literal $res]
			    my debug-constfold {
				puts "$b:$pc: $q"
				puts "    replace [lindex $q 1] with $res"
			    }

			    my replaceUses [lindex $q 1] $res
			    set changed 1

			}
		    }

		    "eq" {
			lassign $argl x y
			set res [list literal [expr {$x == $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "exists" {
			lassign $argl x
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with {literal 1}"
			}

			my replaceUses [lindex $q 1] {literal 1}
			set changed 1

		    }

		    "extractArray" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}








|


<

<
|
>









|
|

>
|

>







|

>
|

>







|

>
|

>







|

>
|

>







|

>
|

>












|

>
|

>








|

>
|

>








|

>
|

>









|

>
|

>












|

>
|

>








|

>
|

>






|

>
|

>







109
110
111
112
113
114
115
116
117
118

119

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement {literal 1}
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement {literal 0}
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace $result with\
                                      $replacement and remove the instruction"
			    }

			    my removeUse $source $b

			    dict unset udchain $result
			    my replaceUses $result $replacement
			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "bitand" {
			lassign $argl x y
			set res [list literal [expr {$x & $y}]]
			my debug-constfold {
 			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "bitnot" {
			lassign $argl x
			set res [list literal [expr {~$x}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "bitor" {
			lassign $argl x y
			set res [list literal [expr {$x | $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "bitxor" {
			lassign $argl x y
			set res [list literal [expr {$x ^ $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "copy" {
			lassign $argl res
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "dictExists" {
			set argl [lassign $argl d]
			if {[llength $argl] == 0} {
			    set res 0
			} else {
			    set res [dict exists $d {*}[lreverse $argl]]
			}
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "dictGet" - "dictGetOrNexist" {
			set argl [lassign $argl d]
			set res [dict get $d {*}[lreverse $argl]]
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "dictIncr" {
			set argl [lassign $argl res]
			dict incr res {*}$argl
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }


		    "dictSet" - "dictSetOrUnset" {
			set argl [lassign $argl d]
			dict set d {*}[lreverse $argl]
			set res [list literal $d]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "div" {
			lassign $argl x y
			if {[catch {expr {$x / $y}} res]} {
			    my diagnostic warning $b $pc \
				"expression will divide by zero at run time"
			    lset bbcontent $b [incr newpc] $q
			} else {
			    set res [list literal $res]
			    my debug-constfold {
				puts "$b:$pc: $q"
				puts "    replace $result with $res"
			    }
			    dict unset udchain $result
			    my replaceUses $result $res
			    set changed 1
			    continue; # delete the quad
			}
		    }

		    "eq" {
			lassign $argl x y
			set res [list literal [expr {$x == $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "exists" {
			lassign $argl x
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with {literal 1}"
			}
			dict unset udchain $result
			my replaceUses $result {literal 1}
			set changed 1
			continue; # delete the quad
		    }

		    "extractArray" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}

284
285
286
287
288
289
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement [list literal $source]
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    # This is dead code, but we don't know it yet
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace [lindex $q 1] with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b
			    my replaceUses [lindex $q 1] $replacement
			    dict unset udchain [lindex $q 1]

			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "extractScalar" {
			my debug-constfold {







|


<

<
|
>







311
312
313
314
315
316
317
318
319
320

321

322
323
324
325
326
327
328
329
330
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement [list literal $source]
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    # This is dead code, but we don't know it yet
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace $result with\
                                      $replacement and remove the instruction"
			    }

			    my removeUse $source $b

			    dict unset udchain $result
			    my replaceUses $result $replacement
			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "extractScalar" {
			my debug-constfold {
317
318
319
320
321
322
323
324
325
326
327
328
329
330

331
332
333
334
335
336
337
338
339
340
341
342

343
344

345
346
347
348
349
350
351
352
353

354
355

356
357
358
359
360
361
362
363

364
365

366
367
368
369
370
371
372
			if {[quadcode::dataType::isa $have $want]} {
			    # This is dead code, but we don't know it yet
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement [list literal $source]
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace [lindex $q 1] with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b
			    my replaceUses [lindex $q 1] $replacement
			    dict unset udchain [lindex $q 1]

			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "ge" {
			lassign $argl x y
			set res [list literal [expr {$x >= $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "gt" {
			lassign $argl x y
			set res [list literal [expr {$x > $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "initIfNotExists" {
			set res [list literal [lindex $argl 0]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "instanceOf" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}








|


<

<
|
>










|

>
|

>







|

>
|

>






|

>
|

>







343
344
345
346
347
348
349
350
351
352

353

354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
			if {[quadcode::dataType::isa $have $want]} {
			    # This is dead code, but we don't know it yet
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement [list literal $source]
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace $result with\
                                      $replacement and remove the instruction"
			    }

			    my removeUse $source $b

			    dict unset udchain $result
			    my replaceUses $result $replacement
			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "ge" {
			lassign $argl x y
			set res [list literal [expr {$x >= $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "gt" {
			lassign $argl x y
			set res [list literal [expr {$x > $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "initIfNotExists" {
			set res [list literal [lindex $argl 0]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "instanceOf" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}

382
383
384
385
386
387
388
389
390
391
392
393
394
395

396
397
398
399
400
401
402
403
404
405
406
407

408
409

410
411
412
413
414
415
416
417
418
419

420

421
422
423
424
425
426
427
428
429
430

431
432

433
434
435
436
437
438
439
440

441
442

443
444
445
446
447
448
449
450

451
452

453
454
455
456
457
458
459
460

461
462

463
464
465
466
467
468
469
470

471
472

473
474
475
476
477
478
479
480
481

482
483

484
485
486
487
488
489
490
491
492
493
494
495
496
497

498
499

500
501
502
503
504
505
506
507
508
509

510
511

512
513
514
515
516
517
518
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement {literal 1}
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement {literal 0}
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace [lindex $q 1] with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b
			    my replaceUses [lindex $q 1] $replacement
			    dict unset udchain [lindex $q 1]

			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "le" {
			lassign $argl x y
			set res [list literal [expr {$x <= $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "list" {
			set res [list literal [list {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}
			my replaceUses [lindex $q 1] $res
			dict unset udchain [lindex $q 1]

			set changed 1

		    }

		    "listAppend" {
			set res [lindex $argl 0]
			lappend res {*}[lrange $argl 1 end]
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "listConcat" {
			set res [list literal [concat {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "listIndex" {
			set res [list literal [lindex {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "listLength" {
			set res [list literal [llength {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "listRange" {
			set res [list literal [lrange {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "lt" {
			lassign $argl x y
			set res [list literal [expr {$x < $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "mod" {
			lassign $argl x y
			if {[catch {expr {$x % $y}} res]} {
			    my diagnostic warning $b $pc \
				"expression will divide by zero at run time"
			    lset bbcontent $b [incr newpc] $q
			} else {
			    set res [list literal $res]
			    my debug-constfold {
				puts "$b:$pc: $q"
				puts "    replace [lindex $q 1] with $res"
			    }

			    my replaceUses [lindex $q 1] $res
			    set changed 1

			}
		    }

		    "mult" {
			lassign $argl x y
			set res [list literal [expr {$x * $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "narrowToType" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}








|




<
|
>










|

>
|

>






|

<
|
>

>








|

>
|

>






|

>
|

>






|

>
|

>






|

>
|

>






|

>
|

>







|

>
|

>












|

>
|

>








|

>
|

>







413
414
415
416
417
418
419
420
421
422
423
424

425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement {literal 1}
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    set replacement {literal 0}
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace $result with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b

			    dict unset udchain $result
			    my replaceUses $result $replacement
			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "le" {
			lassign $argl x y
			set res [list literal [expr {$x <= $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "list" {
			set res [list literal [list {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}

			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "listAppend" {
			set res [lindex $argl 0]
			lappend res {*}[lrange $argl 1 end]
			set res [list literal $res]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "listConcat" {
			set res [list literal [concat {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "listIndex" {
			set res [list literal [lindex {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "listLength" {
			set res [list literal [llength {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "listRange" {
			set res [list literal [lrange {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "lt" {
			lassign $argl x y
			set res [list literal [expr {$x < $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "mod" {
			lassign $argl x y
			if {[catch {expr {$x % $y}} res]} {
			    my diagnostic warning $b $pc \
				"expression will divide by zero at run time"
			    lset bbcontent $b [incr newpc] $q
			} else {
			    set res [list literal $res]
			    my debug-constfold {
				puts "$b:$pc: $q"
				puts "    replace $result with $res"
			    }
			    dict unset udchain $result
			    my replaceUses $result $res
			    set changed 1
			    continue; # delete the quad
			}
		    }

		    "mult" {
			lassign $argl x y
			set res [list literal [expr {$x * $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "narrowToType" {
			my debug-constfold {
			    puts "$b:$pc: examine $q"
			}

528
529
530
531
532
533
534
535
536
537
538
539
540
541

542
543
544
545
546
547
548
549
550
551
552
553

554
555

556
557
558
559
560
561
562
563
564

565
566

567
568
569
570
571
572
573
574

575
576

577
578
579
580
581
582
583
584

585
586

587
588
589
590
591
592
593
594
595

596
597

598
599
600
601
602
603
604
605

606
607

608
609
610
611
612
613
614

615
616

617
618
619
620
621
622
623
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement [lindex $q 0]
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    # this is dead code, but we don't know it yet
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace [lindex $q 1] with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b
			    my replaceUses [lindex $q 1] $replacement
			    dict unset udchain [lindex $q 1]

			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "ne" {
			lassign $argl x y
			set res [list literal [expr {$x != $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "not" {
			lassign $argl x
			set res [list literal [expr {!$x}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }			

		    "strcat" {
			set res [list literal [join $argl ""]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "strrange" {
			set res [list literal [string range {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "sub" {
			lassign $argl x y
			set res [list literal [expr {$x - $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

		 	my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "uminus" {
			set res [list literal [expr {- [lindex $argl 0]}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with $res"
			}

			my replaceUses [lindex $q 1] $res
			set changed 1

		    }

		    "unset" {
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace [lindex $q 1] with Nothing"
			}

			my replaceUses [lindex $q 1] Nothing
			set changed 1

		    }

		    default {
			my debug-constfold {
			    puts "$b:$pc: $q"
			}
			my diagnostic debug $b $pc \







|




<
|
>










|

>
|

>







|

>
|

>






|

>
|

>






|

>
|

>







|

>
|

>






|

>
|

>





|

>
|

>







578
579
580
581
582
583
584
585
586
587
588
589

590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
			if {[quadcode::dataType::isa $have $want]} {
			    set replacement [lindex $q 0]
			} elseif {![quadcode::dataType::mightbea $have $want]} {
			    # this is dead code, but we don't know it yet
			}
			if {[info exists replacement]} {
			    my debug-constfold {
				puts "$b:$pc: can replace $result with\
                                      $replacement and remove the instruction"
			    }
			    lset bbcontent $b $pc [list nop {}]
			    my removeUse $source $b

			    dict unset udchain $result
			    my replaceUses $result $replacement
			    set changed 1
			    continue; # delete the quad
			}			
		    }

		    "ne" {
			lassign $argl x y
			set res [list literal [expr {$x != $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "not" {
			lassign $argl x
			set res [list literal [expr {!$x}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }			

		    "strcat" {
			set res [list literal [join $argl ""]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "strrange" {
			set res [list literal [string range {*}$argl]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "sub" {
			lassign $argl x y
			set res [list literal [expr {$x - $y}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
		 	my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "uminus" {
			set res [list literal [expr {- [lindex $argl 0]}]]
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with $res"
			}
			dict unset udchain $result
			my replaceUses $result $res
			set changed 1
			continue; # delete the quad
		    }

		    "unset" {
			my debug-constfold {
			    puts "$b:$pc: $q"
			    puts "    replace $result with Nothing"
			}
			dict unset udchain $result
			my replaceUses $result Nothing
			set changed 1
			continue; # delete the quad
		    }

		    default {
			my debug-constfold {
			    puts "$b:$pc: $q"
			}
			my diagnostic debug $b $pc \
Changes to quadcode/dbginfo.tcl.
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
		    set debugScript {}
		}
		break
	    }

	}
    }

    return [list $sourcefile $debugLines $debugScript $debugContext]
}

# quadcode::transformer method propDebugInfo --
#
#	Propagates debug information across the quadcode so that
#	it is available locally in each basic block rather than







<







65
66
67
68
69
70
71

72
73
74
75
76
77
78
		    set debugScript {}
		}
		break
	    }

	}
    }

    return [list $sourcefile $debugLines $debugScript $debugContext]
}

# quadcode::transformer method propDebugInfo --
#
#	Propagates debug information across the quadcode so that
#	it is available locally in each basic block rather than
Changes to quadcode/pre.tcl.
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	    bitand bitnot bitor bitxor
	    concat
	    dictAppend dictExists dictGet dictGetOrNexist
	    dictLappend dictSet dictSetOrUnset dictSize dictUnset
	    div
	    eq expand exists expon extractArray extractCallFrame extractExists
	    extractFail extractMaybe extractScalar
	    foreachAdvance foreachIter foreachMayStep foreachStart
	    frameArgs frameDepth
	    ge gt
	    initArray initArrayIfNotExists initIfNotExists
	    instanceOf isBoolean
	    le
	    listAppend listConcat listIn listIndex listLength listRange
	    listSet







<







65
66
67
68
69
70
71

72
73
74
75
76
77
78
	    bitand bitnot bitor bitxor
	    concat
	    dictAppend dictExists dictGet dictGetOrNexist
	    dictLappend dictSet dictSetOrUnset dictSize dictUnset
	    div
	    eq expand exists expon extractArray extractCallFrame extractExists
	    extractFail extractMaybe extractScalar

	    frameArgs frameDepth
	    ge gt
	    initArray initArrayIfNotExists initIfNotExists
	    instanceOf isBoolean
	    le
	    listAppend listConcat listIn listIndex listLength listRange
	    listSet
185
186
187
188
189
190
191



192
193
194
195
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210
	my audit-duchain pre-3
	my audit-phis pre-3
    } trouble opts]} {
	puts stderr "TROUBLE: $trouble"
	return -options ${opts} $trouble
    }
    set did_something [my pre_insert]




    # 4. Rewrite the program to replace calculations of available values
    #    with copies from the temps that hold the values

    if {[catch {
	my audit-duchain pre-4
	my audit-phis pre-4
    } trouble opts]} {
	puts stderr "TROUBLE: $trouble"
	return -options ${opts} $trouble
    }
    if {[my pre_eliminate]} {

	set did_something 1
    }

    # 5. Now, dead code elimination and copy propagation will eliminate
    #    any messes that step 4 left behind.
    
    if {[catch {







>
>
>












>







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	my audit-duchain pre-3
	my audit-phis pre-3
    } trouble opts]} {
	puts stderr "TROUBLE: $trouble"
	return -options ${opts} $trouble
    }
    set did_something [my pre_insert]
    if {$did_something} {
	puts "pre_insert did something!"
    }

    # 4. Rewrite the program to replace calculations of available values
    #    with copies from the temps that hold the values

    if {[catch {
	my audit-duchain pre-4
	my audit-phis pre-4
    } trouble opts]} {
	puts stderr "TROUBLE: $trouble"
	return -options ${opts} $trouble
    }
    if {[my pre_eliminate]} {
	puts "Eliminate did something!"
	set did_something 1
    }

    # 5. Now, dead code elimination and copy propagation will eliminate
    #    any messes that step 4 left behind.
    
    if {[catch {
870
871
872
873
874
875
876








877
878
879
880
881
882
883
oo::define quadcode::transformer method pre_insert_do_expr {b v e} {

    my variable pre_new_sets

    my debug-pre {
	puts "Examine value $v: $e for code motion at entry to block $b"
    }









    # Is this a point where it's appropriate to insert (It is if
    # the value is available on at least one predecessor, and not on all).

    set avail [my pre_insertion_point $b $v $e]
    if {[dict size $avail] == 0} {
	my debug-pre {







>
>
>
>
>
>
>
>







873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
oo::define quadcode::transformer method pre_insert_do_expr {b v e} {

    my variable pre_new_sets

    my debug-pre {
	puts "Examine value $v: $e for code motion at entry to block $b"
    }

    if {[my pre_gvn_is_literal $v -]} {
	my debug-pre {
	    puts "$v: $e is a literal - there's nothing to be done."
	}	    
	return 0;		# There's nothing to insert for a literal
    }
	

    # Is this a point where it's appropriate to insert (It is if
    # the value is available on at least one predecessor, and not on all).

    set avail [my pre_insertion_point $b $v $e]
    if {[dict size $avail] == 0} {
	my debug-pre {
1061
1062
1063
1064
1065
1066
1067


1068
1069
1070





1071
1072
1073
1074
1075
1076
1077
	    set tv [my pre_gvn_lookup_or_add $eprime]
	    my pre_gvn_add [list {} $t] $tv
	    set insn [list $opcode $t]
	    foreach a $argl {
		if {[lindex $a 0] ne "value"} {
		    lappend insn $a
		} else {


		    set var [dict get $avail_out_p [lindex $a 1]]
		    my addUse $var $p
		    lappend insn $var





		}
	    }

	    # Insert the instruction in the block
	    set pb [lindex $bbcontent $p]
	    lset bbcontent $p {}
	    my debug-pre {







>
>
|
|
|
>
>
>
>
>







1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
	    set tv [my pre_gvn_lookup_or_add $eprime]
	    my pre_gvn_add [list {} $t] $tv
	    set insn [list $opcode $t]
	    foreach a $argl {
		if {[lindex $a 0] ne "value"} {
		    lappend insn $a
		} else {
		    set v [lindex $a 1]
		    if {[dict exists $avail_out_p $v]} {
			set var [dict get $avail_out_p $v]
			my addUse $var $p
			lappend insn $var
		    } elseif {[my pre_gvn_is_literal $v lit]} {
			lappend insn $lit
		    } else {
			error "$v is unavailable at end of $p!"
		    }
		}
	    }

	    # Insert the instruction in the block
	    set pb [lindex $bbcontent $p]
	    lset bbcontent $p {}
	    my debug-pre {
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
		}
	    }
	    
	    lappend newbb $q
	}
	lset bbcontent $b $newbb
    }
    my debug-pre {
	if {$changed} {
	    puts "Something has changed in PRE"
	} else {
	    puts "Nothing has changed in PRE"
	}
    }
    return $changed
}

# quadcode::transformer method pre_cleanup --
#
#	Clean up globals left behind by partial redundancy elimination
#







<
<
<
<
<
|
<







1208
1209
1210
1211
1212
1213
1214





1215

1216
1217
1218
1219
1220
1221
1222
		}
	    }
	    
	    lappend newbb $q
	}
	lset bbcontent $b $newbb
    }







    return $changed
}

# quadcode::transformer method pre_cleanup --
#
#	Clean up globals left behind by partial redundancy elimination
#
1504
1505
1506
1507
1508
1509
1510






























    if {$x == -1} {		# We haven't seen the expression yet
	set x [llength $pre_vexprs]
	lappend pre_vexprs {}
	my pre_gvn_add $e $x
    }
    return $x
}





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
    if {$x == -1} {		# We haven't seen the expression yet
	set x [llength $pre_vexprs]
	lappend pre_vexprs {}
	my pre_gvn_add $e $x
    }
    return $x
}

# quadcode::transformer method pre_gvn_is_literal --
#
#	Determines whether a given value represents a literal.
#
# Parameters:
#	v - Value number to examine
#	litVar - Name of a variable in caller's scope that should receive
#	         the literal that the value number represents
#
# Results:
#	Returns 1 if the value represents a literal, 0 otherwise.
#
# Side effects:
#	Stores the name in 'litVar' if the value represents a literal

oo::define quadcode::transformer method pre_gvn_is_literal {v litVar} {
    upvar 1 $litVar lit

    my variable pre_vexprs

    foreach expr [lindex $pre_vexprs $v] {
	if {[lindex $expr 0] eq "literal"} {
	    set lit $expr
	    return 1
	}
    }

    return 0
}
Changes to quadcode/transformer.tcl.
598
599
600
601
602
603
604



605
606
607
608
609
610
611
612
613
614
615
616
	    copyprop
	    cleanupMoveFromCallFrame
	    cleanupMoveToCallFrame
	    cleanupCallFrameUse
	    cleanupNarrow
	    deadjump
	    deadbb



	    deadvars
	    uselessphis
	    constfold
	    bbidom
	    bblevel
	    partialredundancy
	} {
	    set cmd [string map [list @pass $pass] {
		set result [my @pass]
	    }]
	    lappend timings $pass [lindex [time $cmd] 0]
	    if {$result} {







>
>
>



<
<







598
599
600
601
602
603
604
605
606
607
608
609
610


611
612
613
614
615
616
617
	    copyprop
	    cleanupMoveFromCallFrame
	    cleanupMoveToCallFrame
	    cleanupCallFrameUse
	    cleanupNarrow
	    deadjump
	    deadbb
	    bbidom
	    bblevel
	    constfold
	    deadvars
	    uselessphis
	    constfold


	    partialredundancy
	} {
	    set cmd [string map [list @pass $pass] {
		set result [my @pass]
	    }]
	    lappend timings $pass [lindex [time $cmd] 0]
	    if {$result} {