; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -newgvn -enable-phi-of-ops=true -S < %s | FileCheck %s ; RUN: opt -passes=newgvn -enable-phi-of-ops=true -S -o - %s | FileCheck %s target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ;; All the loads in this testcase are useless, but it requires understanding that repeated ;; stores of the same value do not change the memory state to eliminate them. define i32 @foo(i32*, i32) { ; CHECK-LABEL: @foo( ; CHECK-NEXT: store i32 5, i32* [[TMP0:%.*]], align 4 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1:%.*]], 0 ; CHECK-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]] ; CHECK: br label [[TMP5]] ; CHECK: [[PHIOFOPS:%.*]] = phi i32 [ 10, [[TMP2:%.*]] ], [ 15, [[TMP4]] ] ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 10, [[TMP4]] ], [ 5, [[TMP2]] ] ; CHECK-NEXT: br i1 [[TMP3]], label [[TMP6:%.*]], label [[TMP7:%.*]] ; CHECK: br label [[TMP7]] ; CHECK: [[DOT1:%.*]] = phi i32 [ [[PHIOFOPS]], [[TMP6]] ], [ [[DOT0]], [[TMP5]] ] ; CHECK-NEXT: ret i32 [[DOT1]] ; store i32 5, i32* %0, align 4 %3 = icmp ne i32 %1, 0 br i1 %3, label %4, label %7 ;