On 01/16/2013 02:28 AM, Bin.Cheng wrote:
Hi,
For below simple function from newlib:
static int
is_option (char *argv_element, int only)
{
return ((argv_element == 0)
|| (argv_element[0] == '-') || (only && argv_element[0] == '+'));
}
The expanded rtl is like:
9: NOTE_INSN_BASIC_BLOCK 2
2: r113:SI=r0:SI
3: r114:SI=r1:SI
4: NOTE_INSN_FUNCTION_BEG
11: pc={(r113:SI==0)?L39:pc}
REG_BR_PROB 0x3f6
12: NOTE_INSN_BASIC_BLOCK 3
13: r111:SI=zero_extend([r113:SI])
14: pc={(r111:SI==0x2d)?L43:pc}
REG_BR_PROB 0x7c7
15: NOTE_INSN_BASIC_BLOCK 4
16: pc={(r114:SI!=0)?L20:pc}
REG_BR_PROB 0x1388
22: L22:
17: NOTE_INSN_BASIC_BLOCK 5
6: r110:SI=0
20: L20:
21: NOTE_INSN_BASIC_BLOCK 6
23: pc={(r111:SI!=0x2b)?L22:pc}
REG_BR_PROB 0x1f49
35: NOTE_INSN_BASIC_BLOCK 7
8: r110:SI=0x1
39: L39:
38: NOTE_INSN_BASIC_BLOCK 8
7: r110:SI=0x1
43: L43:
42: NOTE_INSN_BASIC_BLOCK 9
5: r110:SI=0x1
24: L24:
25: NOTE_INSN_BASIC_BLOCK 10
26: r112:SI=r110:SI
30: r0:SI=r112:SI
33: use r0:SI
Basic blocks 8/9/10 are identical and live until pass jump2, which is
after register allocation.
I think these duplicated BBs do not contain additional information and
should be better to be removed ASAP, because they might interfere with
other passes like ifcvt.
So should this issue be handled like in jump pass?
In this case, I'd expect DCE to optimize away the redundant assignments.
jeff