32 lines · plain
1; RUN: llc -mtriple aarch64 -o /dev/null %s2 3; This used to fail with:4; Assertion `N1.getOpcode() != ISD::DELETED_NODE &&5; "Operand is DELETED_NODE!"' failed.6; Just make sure we do not crash here.7define void @test_fold_freeze_over_select_cc(i15 %a, ptr %p1, ptr %p2) {8entry:9 %a2 = add nsw i15 %a, 110 %sext = sext i15 %a2 to i3211 %ashr = ashr i32 %sext, 3112 %lshr = lshr i32 %ashr, 713 ; Setup an already frozen input to ctlz.14 %freeze = freeze i32 %lshr15 %ctlz = call i32 @llvm.ctlz.i32(i32 %freeze, i1 true)16 store i32 %ctlz, ptr %p1, align 117 ; Here is another ctlz, which is used by a frozen select.18 ; DAGCombiner::visitFREEZE will to try to fold the freeze over a SELECT_CC,19 ; and when dealing with the condition operand the other SELECT_CC operands20 ; will be replaced/simplified as well. So the SELECT_CC is mutated while21 ; freezing the "maybe poison operands". This needs to be handled by22 ; DAGCombiner::visitFREEZE, as it can't store the list of SDValues that23 ; should be frozen in a separate data structure that isn't updated when the24 ; SELECT_CC is mutated.25 %ctlz1 = call i32 @llvm.ctlz.i32(i32 %lshr, i1 true)26 %icmp = icmp ne i32 %lshr, 027 %select = select i1 %icmp, i32 %ctlz1, i32 028 %freeze1 = freeze i32 %select29 store i32 %freeze1, ptr %p2, align 130 ret void31}32