; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 ; PR32952: Don't erroneously consider congruent two phi nodes which ; have the same arguments but different incoming edges. ; RUN: opt -passes=newgvn -S %s | FileCheck %s @a = common global i16 0, align 2 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 define i32 @tinkywinky() { ; CHECK-LABEL: define i32 @tinkywinky() { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr @a, align 2 ; CHECK-NEXT: [[CONV:%.*]] = sext i16 [[TMP0]] to i32 ; CHECK-NEXT: [[NEG:%.*]] = xor i32 [[CONV]], -1 ; CHECK-NEXT: [[CONV1:%.*]] = trunc i32 [[NEG]] to i16 ; CHECK-NEXT: [[CONV3:%.*]] = zext i16 [[CONV1]] to i32 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[CONV]], [[CONV3]] ; CHECK-NEXT: br i1 [[CMP]], label [[TINKY:%.*]], label [[WINKY:%.*]] ; CHECK: tinky: ; CHECK-NEXT: store i16 2, ptr @a, align 2 ; CHECK-NEXT: br label [[PATATINO:%.*]] ; CHECK: winky: ; CHECK-NEXT: br label [[PATATINO]] ; CHECK: patatino: ; CHECK-NEXT: [[MEH:%.*]] = phi i16 [ [[TMP0]], [[WINKY]] ], [ [[CONV1]], [[TINKY]] ] ; CHECK-NEXT: [[BANANA:%.*]] = phi i16 [ [[TMP0]], [[TINKY]] ], [ [[CONV1]], [[WINKY]] ] ; CHECK-NEXT: br label [[END:%.*]] ; CHECK: end: ; CHECK-NEXT: [[PROMOTED:%.*]] = zext i16 [[BANANA]] to i32 ; CHECK-NEXT: [[OTHER:%.*]] = zext i16 [[MEH]] to i32 ; CHECK-NEXT: [[FIRST:%.*]] = tail call i32 (ptr, ...) @printf(ptr @.str, i32 [[PROMOTED]]) ; CHECK-NEXT: [[SECOND:%.*]] = tail call i32 (ptr, ...) @printf(ptr @.str, i32 [[OTHER]]) ; CHECK-NEXT: ret i32 0 ; entry: %0 = load i16, ptr @a, align 2 %conv = sext i16 %0 to i32 %neg = xor i32 %conv, -1 %conv1 = trunc i32 %neg to i16 %conv3 = zext i16 %conv1 to i32 %cmp = icmp slt i32 %conv, %conv3 br i1 %cmp, label %tinky, label %winky tinky: store i16 2, ptr @a, align 2 br label %patatino winky: br label %patatino patatino: %meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ] %banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ] br label %end end: %promoted = zext i16 %banana to i32 %other = zext i16 %meh to i32 %first = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %promoted) %second = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %other) ret i32 0 } declare i32 @printf(ptr, ...)