28 lines · plain
1; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64-linux < %s | FileCheck %s2 3declare void @llvm.assume(i1 noundef) nounwind willreturn4 5; Recursively deleting dead operands of assume() may result in its next6; instruction deleted and the iterator pointing to the next instruction7; invalidated. This prevents the following simple loop in8; 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 %loop19 20; CHECK: loop:21; CHECK-NEXT: br label %loop22loop:23 %cond3 = phi i1 [%cond1, %entry], [%cond4, %loop]24 call void @llvm.assume(i1 %cond3)25 %cond4 = icmp ult i1 %cond1, %cond226 br label %loop27}28