Home | History | Annotate | Download | only in NewGVN
      1 ; PR32952: Don't erroneously consider congruent two phi nodes which
      2 ; have the same arguments but different incoming edges.
      3 ; RUN: opt -newgvn -S %s | FileCheck %s
      4 
      5 @a = common global i16 0, align 2
      6 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
      7 
      8 define i32 @tinkywinky() {
      9 entry:
     10   %0 = load i16, i16* @a, align 2
     11   %conv = sext i16 %0 to i32
     12   %neg = xor i32 %conv, -1
     13   %conv1 = trunc i32 %neg to i16
     14   %conv3 = zext i16 %conv1 to i32
     15   %cmp = icmp slt i32 %conv, %conv3
     16   br i1 %cmp, label %tinky, label %winky
     17 
     18 tinky:
     19   store i16 2, i16* @a, align 2
     20   br label %patatino
     21 
     22 winky:
     23   br label %patatino
     24 
     25 patatino:
     26 ; CHECK: %meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ]
     27 ; CHECK: %banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ]
     28   %meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ]
     29   %banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ]
     30   br label %end
     31 
     32 end:
     33 ; CHECK: %promoted = zext i16 %banana to i32
     34 ; CHECK: %other = zext i16 %meh to i32
     35   %promoted = zext i16 %banana to i32
     36   %other = zext i16 %meh to i32
     37   %first = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %promoted)
     38   %second = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %other)
     39   ret i32 0
     40 }
     41 
     42 declare i32 @printf(i8*, ...)
     43