llvm-project/llvm/test/Transforms/NewGVN/metadata-simplify.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

161 lines
4.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; The tests in this file check that we do not simplify based on metadata that is
; not available on all code paths.
; RUN: opt < %s -S -passes=newgvn | FileCheck %s
define i1 @test1(i32** %arg, i1 %arg2) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]], !nonnull !0
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32*, i32** [[ARG]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32*, i32** %arg, !nonnull !0
%cmp1 = icmp eq i32* %load1, null
ret i1 %cmp1
bb2:
%load2 = load i32*, i32** %arg
%cmp2 = icmp eq i32* %load2, null
ret i1 %cmp2
}
define i1 @test2(i32** %arg, i1 %arg2) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32*, i32** [[ARG]], !nonnull !0
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32*, i32** %arg
%cmp1 = icmp eq i32* %load1, null
ret i1 %cmp1
bb2:
%load2 = load i32*, i32** %arg, !nonnull !0
%cmp2 = icmp eq i32* %load2, null
ret i1 %cmp2
}
define i1 @test3(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32, i32* %ptr, !range !1
%cmp1 = icmp ne i32 %load1, 999
ret i1 %cmp1
bb2:
%load2 = load i32, i32* %ptr
%cmp2 = icmp ne i32 %load2, 999
ret i1 %cmp2
}
define i1 @test4(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32, i32* %ptr
%cmp1 = icmp ne i32 %load1, 999
ret i1 %cmp1
bb2:
%load2 = load i32, i32* %ptr, !range !1
%cmp2 = icmp ne i32 %load2, 999
ret i1 %cmp2
}
define i1 @test5(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32, i32* %ptr, !range !1
%cmp1 = icmp slt i32 %load1, 999
ret i1 %cmp1
bb2:
%load2 = load i32, i32* %ptr
%cmp2 = icmp slt i32 %load2, 999
ret i1 %cmp2
}
define i1 @test6(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
br i1 %arg2, label %bb1, label %bb2
bb1:
%load1 = load i32, i32* %ptr
%cmp1 = icmp slt i32 %load1, 999
ret i1 %cmp1
bb2:
%load2 = load i32, i32* %ptr, !range !1
%cmp2 = icmp slt i32 %load2, 999
ret i1 %cmp2
}
!0 = !{}
!1 = !{ i32 10, i32 20 }