[LLVMdev] is createCFGSimplificationPass unused?

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Nov 2 17:39:55 PST 2006


It looks like createCFGSimplificationPass was disabled on 2006/09/04.
This causes some problems for architectures that use conditional moves
to implement select (alpha and ARM). For example, on 2006/09/03 a "if
(a) return 0; else return 1;" compiled to
----------------------------------------
        zapnot $17,15,$1
        zapnot $16,15,$2
        bis $31,$31,$0
        cmpeq $2,$1,$1
        cmoveq $1,1,$0
        ret $31,($26),1
----------------------------------------

Now it compiles to

----------------------------------
        zapnot $17,15,$0
        zapnot $16,15,$1
        cmpeq $1,$0,$0
        beq $0,$BB1_2   #return
$BB1_1: #cond_true
        bis $31,$31,$0
        ret $31,($26),1
$BB1_2: #return
        lda $0,1($31)
        ret $31,($26),1
----------------------------------

I have added createCFGSimplificationPass in
ARMTargetMachine::addInstSelector to fix this problem. Is this the
correct solution? I think that more architectures might benefit...

Best Regards,
Rafael



More information about the llvm-dev mailing list