80 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt < %s -passes=newgvn -S | FileCheck %s3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"4target triple = "x86_64-apple-macosx10.7.0"5 6; rdar://128015847; Value of %shouldExit can be changed by RunInMode.8; Make sure we do not replace load %shouldExit in while.cond.backedge9; with a phi node where the value from while.body is 0.10define i32 @test() nounwind ssp {11; CHECK-LABEL: define i32 @test(12; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {13; CHECK-NEXT: entry:14; CHECK-NEXT: [[SHOULDEXIT:%.*]] = alloca i32, align 415; CHECK-NEXT: [[TASKSIDLE:%.*]] = alloca i32, align 416; CHECK-NEXT: store i32 0, ptr [[SHOULDEXIT]], align 417; CHECK-NEXT: store i32 0, ptr [[TASKSIDLE]], align 418; CHECK-NEXT: call void @CTestInitialize(ptr [[TASKSIDLE]]) #[[ATTR1:[0-9]+]]19; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[SHOULDEXIT]], align 420; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP0]], 021; CHECK-NEXT: br i1 [[CMP1]], label [[WHILE_BODY_LR_PH:%.*]], label [[WHILE_END:%.*]]22; CHECK: while.body.lr.ph:23; CHECK-NEXT: br label [[WHILE_BODY:%.*]]24; CHECK: while.body:25; CHECK-NEXT: call void @RunInMode(i32 100) #[[ATTR1]]26; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TASKSIDLE]], align 427; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP1]], 028; CHECK-NEXT: br i1 [[TOBOOL]], label [[WHILE_COND_BACKEDGE:%.*]], label [[IF_THEN:%.*]]29; CHECK: if.then:30; CHECK-NEXT: store i32 0, ptr [[TASKSIDLE]], align 431; CHECK-NEXT: call void @TimerCreate(ptr [[SHOULDEXIT]]) #[[ATTR1]]32; CHECK-NEXT: br label [[WHILE_COND_BACKEDGE]]33; CHECK: while.cond.backedge:34; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[SHOULDEXIT]], align 435; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP2]], 036; CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY]], label [[WHILE_COND_WHILE_END_CRIT_EDGE:%.*]]37; CHECK: while.cond.while.end_crit_edge:38; CHECK-NEXT: br label [[WHILE_END]]39; CHECK: while.end:40; CHECK-NEXT: ret i32 041;42entry:43 %shouldExit = alloca i32, align 444 %tasksIdle = alloca i32, align 445 store i32 0, ptr %shouldExit, align 446 store i32 0, ptr %tasksIdle, align 447 call void @CTestInitialize(ptr %tasksIdle) nounwind48 %0 = load i32, ptr %shouldExit, align 449 %cmp1 = icmp eq i32 %0, 050 br i1 %cmp1, label %while.body.lr.ph, label %while.end51 52while.body.lr.ph:53 br label %while.body54 55while.body:56 call void @RunInMode(i32 100) nounwind57 %1 = load i32, ptr %tasksIdle, align 458 %tobool = icmp eq i32 %1, 059 br i1 %tobool, label %while.cond.backedge, label %if.then60 61if.then:62 store i32 0, ptr %tasksIdle, align 463 call void @TimerCreate(ptr %shouldExit) nounwind64 br label %while.cond.backedge65 66while.cond.backedge:67 %2 = load i32, ptr %shouldExit, align 468 %cmp = icmp eq i32 %2, 069 br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge70 71while.cond.while.end_crit_edge:72 br label %while.end73 74while.end:75 ret i32 076}77declare void @CTestInitialize(ptr)78declare void @RunInMode(i32)79declare void @TimerCreate(ptr)80