1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -passes=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 {{[^@]+}}@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 {{[^@]+}}@f3
30 ; CHECK-SAME: (i16 [[P1:%.*]]) {
32 ; CHECK-NEXT: unreachable
35 switch i16 %p1, label %land.end [
36 i16 0, label %land.end