47 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature2; RUN: opt < %s -passes=ipsccp -S | FileCheck %s3 4; This test case used to end up like this:5;6; While deleting: label %lor.rhs7; Use still stuck around after Def is destroyed: br i1 undef, label %lor.rhs, label %land.end8; opt: ../lib/IR/Value.cpp: llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.9;10; due to ConstantFoldTerminator rewriting the switch into11;12; br i1 undef, label %lor.rhs, label %land.end13;14; while SCCP implementation relied on the terminator to always be folded into15; an unconditional branch when ConstantFoldTerminator returned true.16 17define void @f4() {18; CHECK-LABEL: define {{[^@]+}}@f4() {19; CHECK-NEXT: entry:20; CHECK-NEXT: [[CALL:%.*]] = call i16 @f3(i16 undef)21; CHECK-NEXT: ret void22;23entry:24 %call = call i16 @f3(i16 undef)25 ret void26}27 28define internal i16 @f3(i16 %p1) {29; CHECK-LABEL: define {{[^@]+}}@f330; CHECK-SAME: (i16 [[P1:%.*]]) {31; CHECK-NEXT: entry:32; CHECK-NEXT: unreachable33;34entry:35 switch i16 %p1, label %land.end [36 i16 0, label %land.end37 i16 1, label %lor.rhs38 ]39 40lor.rhs:41 br label %land.end42 43land.end:44 ret i16 045}46 47