File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
llvm/test/Transforms/SimplifyCFG Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,32 @@ default:
280280 ret void
281281}
282282
283+ @G = constant i16 zeroinitializer , align 1
284+
285+ ; Make sure we don't remove edges when the condition is a unresolved constant expression.
286+
287+ define i16 @switch_on_nonimmediate_constant_expr () {
288+ ; CHECK-LABEL: @switch_on_nonimmediate_constant_expr(
289+ ; CHECK-NEXT: entry:
290+ ; CHECK-NEXT: ret i16 789
291+ ;
292+ entry:
293+ switch i32 ptrtoint (ptr @G to i32 ), label %sw.default [
294+ i32 1 , label %sw.bb
295+ i32 2 , label %sw.bb1
296+ ]
297+
298+ sw.bb:
299+ ret i16 123
300+
301+ sw.bb1:
302+ ret i16 456
303+
304+ sw.default:
305+ ret i16 789
306+ }
307+
308+
283309declare void @llvm.trap () nounwind noreturn
284310declare void @bees.a () nounwind
285311declare void @bees.b () nounwind
You can’t perform that action at this time.
0 commit comments