brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · d815fb5 Raw
48 lines · plain
1; RUN: opt -passes=lower-constant-intrinsics -S < %s | FileCheck %s2 3; This is a reproducer for a heap-use-after-free bug that occurred due to trying4; to process a PHI node that was removed in a preceding worklist iteration. The5; conditional branch in %cont2.i will be replaced with an unconditional branch6; to %cont4.i. As a result of that, the PHI node in %handler.type_mismatch3.i7; will be left with one predecessor and will thus be removed in that iteration.8 9; CHECK-NOT: phi10; CHECK: cont2.i:11; CHECK-NEXT: br label %cont4.i12; CHECK-NOT: phi13 14%s = type { [2 x i16] }15 16define fastcc void @foo(ptr %p, i1 %arg) unnamed_addr {17entry:18  %0 = tail call i32 @llvm.objectsize.i32.p0(ptr %p, i1 false, i1 false, i1 false) #219  %1 = icmp ne i32 %0, 020  %.not1.i = icmp eq i32 %0, 021  br label %for.cond22 23for.cond:                                         ; preds = %entry24  br label %cont.i25 26cont.i:                                           ; preds = %for.cond27  br i1 %arg, label %cont2.i, label %cont2.thread.i28 29cont2.thread.i:                                   ; preds = %cont.i30  br label %handler.type_mismatch3.i31 32cont2.i:                                          ; preds = %cont.i33  br i1 %.not1.i, label %handler.type_mismatch3.i, label %cont4.i34 35handler.type_mismatch3.i:                         ; preds = %cont2.i, %cont2.thread.i36  %2 = phi i1 [ %1, %cont2.thread.i ], [ false, %cont2.i ]37  unreachable38 39cont4.i:                                          ; preds = %cont2.i40  unreachable41}42 43; Function Attrs: nofree nosync nounwind readnone speculatable willreturn44declare i32 @llvm.objectsize.i32.p0(ptr, i1 immarg, i1 immarg, i1 immarg) #145 46attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }47attributes #2 = { nounwind }48