[MLton] selects re 0 referenced?!
Lukasz S Ziarek
lziarek@cs.purdue.edu
Wed, 25 Feb 2004 18:21:55 -0500 (EST)
So after hacking for a few hours as to why selecting after a primapp was
generating all sorts of bugs, I finally figured out WHY! The first snippet
of ssa code is before my flatten pass, and it gets transformed into my
second pass.
L_907 (x_1495)
x_1517 = #2 x_1495
x_1498 = #1 x_1495
x_1500 = #5 x_1498
x_1509 = #4 x_1498
x_1516 = Ref_deref (x_1509)
x_1513 = #3 x_1516
x_1514 = #2 x_1516
x_1515 = #1 x_1516
x_1512 = Real64_sub (x_1515, x_1322)
x_1511 = Real64_sub (x_1514, x_1321)
x_1510 = Real64_sub (x_1513, x_1320)
L_907 (x_2081, x_2080, x_2079, x_2078, x_2077, x_2076)
x_1516 = Ref_deref (x_2078)
x_2087 = #2 x_1516
x_2086 = #3 x_1516
x_2085 = #4 x_1516
x_1512 = Real64_sub (x_2087, x_1322)
x_1511 = Real64_sub (x_2086, x_1321)
x_1510 = Real64_sub (x_2085, x_1320)
x_1508 = (x_1512, x_1511, x_1510)
If you notice I select out 2,3,4 instead of 1,2,3. Apparently somewhere
under the hood, some part of the compiler adds 1 to the select index.
Since internally, i am assuming, it is 0 indexed. Wow that caused a
debugging head ache =). I was treating selects as 1 indexed!
Luke