1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -ipsccp -S | FileCheck %s
4 ; This test case used to end up like this:
6 ; While deleting: label %lor.rhs
7 ; Use still stuck around after Def is destroyed: br i1 undef, label %lor.rhs, label %land.end
8 ; opt: ../lib/IR/Value.cpp: llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
10 ; due to ConstantFoldTerminator rewriting the switch into
12 ; br i1 undef, label %lor.rhs, label %land.end
14 ; while SCCP implementation relied on the terminator to always be folded into
15 ; an unconditional branch when ConstantFoldTerminator returned true.
18 ; CHECK-LABEL: define void @f4(
20 ; CHECK-NEXT: [[CALL:%.*]] = call i16 @f3(i16 undef)
21 ; CHECK-NEXT: ret void
24 %call = call i16 @f3(i16 undef)
28 define internal i16 @f3(i16 %p1) {
29 ; CHECK-LABEL: define internal i16 @f3(
31 ; CHECK-NEXT: br label [[LAND_END:%.*]]
33 ; CHECK-NEXT: ret i16 undef
36 switch i16 %p1, label %land.end [
37 i16 0, label %land.end