From 43dc285915f571e7a1e22a15468676006125bc9c Mon Sep 17 00:00:00 2001 From: Geoff Berry Date: Tue, 29 Dec 2015 18:10:16 +0000 Subject: [JumpThreading] Fix opcode bonus in getJumpThreadDuplicationCost() The code that was meant to adjust the duplication cost based on the terminator opcode was not being executed in cases where the initial threshold was hit inside the loop. Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D15536 llvm-svn: 256568 --- llvm/test/Transforms/JumpThreading/select.ll | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'llvm/test/Transforms/JumpThreading/select.ll') diff --git a/llvm/test/Transforms/JumpThreading/select.ll b/llvm/test/Transforms/JumpThreading/select.ll index d0df7725f72..595cacbcbf5 100644 --- a/llvm/test/Transforms/JumpThreading/select.ll +++ b/llvm/test/Transforms/JumpThreading/select.ll @@ -91,6 +91,36 @@ L3: } +; Jump threading of indirectbr with select as address. Test increased +; duplication threshold for cases where indirectbr is being threaded +; through. + +; CHECK-LABEL: @test_indirectbr_thresh( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 %cond, label %L1, label %L3 +; CHECK-NOT: indirectbr +define void @test_indirectbr_thresh(i1 %cond, i8* %address) nounwind { +entry: + br i1 %cond, label %L0, label %L3 +L0: + %indirect.goto.dest = select i1 %cond, i8* blockaddress(@test_indirectbr_thresh, %L1), i8* %address + call void @quux() + call void @quux() + call void @quux() + indirectbr i8* %indirect.goto.dest, [label %L1, label %L2, label %L3] + +L1: + call void @foo() + ret void +L2: + call void @bar() + ret void +L3: + call void @baz() + ret void +} + + ; A more complicated case: the condition is a select based on a comparison. ; CHECK-LABEL: @test_switch_cmp( -- cgit v1.2.3