[llvm] r190309 - [ARMv8] Prevent generation of deprecated IT blocks on ARMv8 in Thumb mode.

Artyom Skrobov Artyom.Skrobov at arm.com
Wed Nov 27 11:49:13 PST 2013

Hello Hal,

>> I'm attaching a new patch which reverts IfConverter::ScanInstructions
>> to its original logic (checking the predicated status of the
>> conditional branches) and implements Thumb2InstrInfo::isPredicated
>> to reflect the somewhat unorthodox "conditional but not predicated"
>> convention for the ARMv8/Thumb conditional branches.
>> Hal, can you confirm that this patch restores the correct functioning
>> on PPC?
> I'll check.
> Why are you restoring this part?
>      if (BBI.ClobbersPred && !isPredicated) {
>        // Predicate modification instruction should end the block (except for
>        // already predicated instructions and end of block branches).
> +      if (isCondBr) {
> +        // A conditional branch is not predicable, but it may be eliminated.
> +        continue;
> +      }
> +

This enables conversion of fragments such as

        cmp     r12, r2
        bne     .LBB6_4
@ BB#2:
        cmp     r1, r3
        bne     .LBB6_4
        strexd  r5, lr, r4, [r0]


        cmp     r12, r2
        it      eq
        cmpeq   r1, r3
        bne     .LBB6_4
@ BB#2:
        strexd  r5, lr, r4, [r0]

As you can see, in this case, the last instruction of the branch (cmp r1, r3; bne .LBB6_4) is not predicable on the branch condition (the original CPSR), but it's going to be eliminated during the conversion, so its non-predicability doesn't matter.

In the meantime, have you been able to create a test case for the invalid PPC code generation being caused by r190309 ?

More information about the llvm-commits mailing list