Files
clang-p2996/llvm/test/Transforms/NewGVN/pr32952.ll
Bjorn Pettersson 4f73528403 [test][NewGVN] Use -passes=newgvn instead of -newgvn
Use the new PM syntax when specifying the pipeline in regression
tests previously running
  "opt -newgvn ..."

Instead we now do
  "opt -passes=newgvn ..."

Notice that this also changes the aa-pipeline to become the default
aa-pipeline instead of just basic-aa. Since these tests haven't been
explicitly requesting basic-aa in the past (compared to the test cases
updated in a separate patch involving "-basic-aa -newgvn") it is
assumed that the exact aa-pipeline isn't important for the validity
of the test cases. An alternative could have been to add
-aa-pipeline=basic-aa as well to the run lines, but that might just
add clutter in case the test cases do not care about the aa-pipeline.

This is another step to move away from the legacy PM syntax when
specifying passes in opt.

Differential Revision: https://reviews.llvm.org/D118341
2022-01-28 13:58:22 +01:00

43 lines
1.3 KiB
LLVM

; 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() {
entry:
%0 = load i16, i16* @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, i16* @a, align 2
br label %patatino
winky:
br label %patatino
patatino:
; CHECK: %meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ]
; CHECK: %banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ]
%meh = phi i16 [ %0, %winky ], [ %conv1, %tinky ]
%banana = phi i16 [ %0, %tinky ], [ %conv1, %winky ]
br label %end
end:
; CHECK: %promoted = zext i16 %banana to i32
; CHECK: %other = zext i16 %meh to i32
%promoted = zext i16 %banana to i32
%other = zext i16 %meh to i32
%first = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %promoted)
%second = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %other)
ret i32 0
}
declare i32 @printf(i8*, ...)