41 lines · plain
1; RUN: llc < %s -mtriple=thumb-apple-darwin -relocation-model=dynamic-no-pic -mcpu=cortex-a8 -asm-verbose=false | FileCheck %s2 3; We should be able to tail-duplicate the basic block containing the indirectbr4; into all of its predecessors.5; CHECK-LABEL: fn:6; CHECK: mov pc7; CHECK: mov pc8; CHECK: mov pc9 10@fn.codetable = internal unnamed_addr constant [3 x ptr] [ptr blockaddress(@fn, %RETURN), ptr blockaddress(@fn, %INCREMENT), ptr blockaddress(@fn, %DECREMENT)], align 411 12define i32 @fn(ptr nocapture %opcodes) nounwind readonly ssp {13entry:14 %0 = load i32, ptr %opcodes, align 415 %arrayidx = getelementptr inbounds [3 x ptr], ptr @fn.codetable, i32 0, i32 %016 br label %indirectgoto17 18INCREMENT: ; preds = %indirectgoto19 %inc = add nsw i32 %result.0, 120 %1 = load i32, ptr %opcodes.addr.0, align 421 %arrayidx2 = getelementptr inbounds [3 x ptr], ptr @fn.codetable, i32 0, i32 %122 br label %indirectgoto23 24DECREMENT: ; preds = %indirectgoto25 %dec = add nsw i32 %result.0, -126 %2 = load i32, ptr %opcodes.addr.0, align 427 %arrayidx4 = getelementptr inbounds [3 x ptr], ptr @fn.codetable, i32 0, i32 %228 br label %indirectgoto29 30indirectgoto: ; preds = %DECREMENT, %INCREMENT, %entry31 %result.0 = phi i32 [ 0, %entry ], [ %dec, %DECREMENT ], [ %inc, %INCREMENT ]32 %opcodes.pn = phi ptr [ %opcodes, %entry ], [ %opcodes.addr.0, %DECREMENT ], [ %opcodes.addr.0, %INCREMENT ]33 %indirect.goto.dest.in = phi ptr [ %arrayidx, %entry ], [ %arrayidx4, %DECREMENT ], [ %arrayidx2, %INCREMENT ]34 %opcodes.addr.0 = getelementptr inbounds i32, ptr %opcodes.pn, i32 135 %indirect.goto.dest = load ptr, ptr %indirect.goto.dest.in, align 436 indirectbr ptr %indirect.goto.dest, [label %RETURN, label %INCREMENT, label %DECREMENT]37 38RETURN: ; preds = %indirectgoto39 ret i32 %result.040}41