@@ -153,3 +153,41 @@ if.end: ; preds = %entry
153153 %mul = fmul float %x , %scale
154154 br label %common.ret18
155155}
156+
157+ ; Test when the icmp can be simplified but the recurison depth is NOT 1,
158+ ; so the recursive call will not be inlined.
159+ define float @no_inline_rec_depth_not_1 (float %x , float %scale ) {
160+ ; CHECK-LABEL: define float @no_inline_rec_depth_not_1(
161+ ; CHECK-SAME: float [[X:%.*]], float [[SCALE:%.*]]) {
162+ ; CHECK-NEXT: [[ENTRY:.*:]]
163+ ; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X]], 0.000000e+00
164+ ; CHECK-NEXT: br i1 [[CMP]], label %[[IF_THEN:.*]], label %[[IF_END:.*]]
165+ ; CHECK: [[COMMON_RET18:.*]]:
166+ ; CHECK-NEXT: [[COMMON_RET18_OP:%.*]] = phi float [ [[CALL:%.*]], %[[IF_THEN]] ], [ [[MUL:%.*]], %[[IF_END]] ]
167+ ; CHECK-NEXT: ret float [[COMMON_RET18_OP]]
168+ ; CHECK: [[IF_THEN]]:
169+ ; CHECK-NEXT: [[CALL]] = tail call float @no_inline_rec_depth_not_1(float [[X]], float [[SCALE]])
170+ ; CHECK-NEXT: br label %[[COMMON_RET18]]
171+ ; CHECK: [[IF_END]]:
172+ ; CHECK-NEXT: [[MUL]] = fmul float [[X]], [[SCALE]]
173+ ; CHECK-NEXT: br label %[[COMMON_RET18]]
174+ ;
175+ entry:
176+ %cmp = fcmp olt float %x , 0 .000000e+00
177+ br i1 %cmp , label %if.then , label %if.end
178+
179+ common .ret18: ; preds = %if.then, %if.end
180+ %common.ret18.op = phi float [ %call , %if.then ], [ %mul , %if.end ]
181+ ret float %common.ret18.op
182+
183+ if.then: ; preds = %entry
184+ %fneg1 = fneg float %x
185+ %fneg = fneg float %fneg1
186+ %call = tail call float @no_inline_rec_depth_not_1 (float %fneg , float %scale )
187+ br label %common.ret18
188+
189+ if.end: ; preds = %entry
190+ %mul = fmul float %x , %scale
191+ br label %common.ret18
192+ }
193+
0 commit comments