Files
clang-p2996/llvm/test/Transforms/NewGVN/assumes.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

39 lines
1.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
define i32 @test1(i32 %arg) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[ARG:%.*]], 5
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
; CHECK-NEXT: ret i32 [[ARG]]
;
%cmp = icmp sge i32 %arg, 5
call void @llvm.assume(i1 %cmp)
ret i32 %arg
}
define i32 @test2(i32 %arg, i1 %b) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: [[A:%.*]] = phi i32 [ 1, [[TMP0:%.*]] ], [ 2, [[BB]] ]
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[ARG:%.*]], [[A]]
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
; CHECK-NEXT: br i1 [[B:%.*]], label [[BB]], label [[END:%.*]]
; CHECK: end:
; CHECK-NEXT: ret i32 [[ARG]]
;
br label %bb
bb:
%a = phi i32 [ 1, %0 ], [ 2, %bb ]
%cmp = icmp eq i32 %arg, %a
call void @llvm.assume(i1 %cmp)
br i1 %b, label %bb, label %end
end:
ret i32 %arg
}
declare void @llvm.assume(i1 %cond)