1; RUN: opt -codegenprepare -S -mtriple=x86_64-linux < %s | FileCheck %s 2 3declare void @llvm.assume(i1 noundef) nounwind willreturn 4 5; Recursively deleting dead operands of assume() may result in its next 6; instruction deleted and the iterator pointing to the next instruction 7; invalidated. This prevents the following simple loop in 8; CodeGenPrepare::optimizeBlock() unless CurInstIterator is fixed: 9; 10; CurInstIterator = BB.begin(); 11; while (CurInstIterator != BB.end()) 12; optimizeInst(&*CurInstIterator++, ModifiedDT); 13; 14define i32 @test_assume_in_loop(i1 %cond1, i1 %cond2) { 15; CHECK-LABEL: @test_assume_in_loop( 16; CHECK-NEXT: entry: 17entry: 18 br label %loop 19 20; CHECK: loop: 21; CHECK-NEXT: br label %loop 22loop: 23 %cond3 = phi i1 [%cond1, %entry], [%cond4, %loop] 24 call void @llvm.assume(i1 %cond3) 25 %cond4 = icmp ult i1 %cond1, %cond2 26 br label %loop 27} 28