Skip to content

Legalize drops conditions and selects #1024

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 652
Resolution FIXED
Resolved on Feb 22, 2010 12:49
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

Legalize makes the last block mostly disappear, and that is bad.

; ModuleID = 'bugpoint.test.bc'
target endian = little
target pointersize = 64

implementation ; Functions:

bool %l5_l14_g721_encoder_then_2E_i(int %tmp.46.reload, short* %tmp.5542.out) {
newFuncRoot:
br label %then.i

cond_true.exitStub: ; preds = %then.i
store short %tmp.5542, short* %tmp.5542.out
ret bool true

cond_false.exitStub: ; preds = %then.i
store short %tmp.5542, short* %tmp.5542.out
ret bool false

then.i: ; preds = %newFuncRoot
%tmp.11.i = setne int %tmp.46.reload, 0 ; [#uses=1]
%tmp.5542 = select bool %tmp.11.i, short -32768, short 0
; [#uses=3]
%tmp.5744 = setlt short %tmp.5542, 0 ; [#uses=1]
br bool %tmp.5744, label %cond_true.exitStub, label %cond_false.exitStub
}

Gets codegened into:
newFuncRoot:
%$31 = BR mbb<then.i,0x120f11190>
cond_true.exitStub:
STW %$0, 0, %$17
%$0 = LDA 1, %$31
%$31 = RET %$26, 1
cond_false.exitStub:
STW %$0, 0, %$17
%$0 = LDA 0, %$31
%$31 = RET %$26, 1
then.i:
%$0 = LDA 0, %$31
%$31 = BR mbb<cond_false.exitStub,0x120f110d0>

then.i is clearly in bad shape.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions