[llvm] [NewGVN][NFC]Regenerate test checks (PR #85280)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 10:56:29 PDT 2024
https://github.com/ManuelJBrito created https://github.com/llvm/llvm-project/pull/85280
Regenerate test checks for NewGVN.
>From 58e7ac951f1f437f25047e1d1a7705617da5edfa Mon Sep 17 00:00:00 2001
From: ManuelJBrito <manuel.brito at tecnico.ulisboa.pt>
Date: Thu, 14 Mar 2024 17:52:26 +0000
Subject: [PATCH] [NewGVN][NFC]Regenerate test checks
---
.../NewGVN/2007-07-25-DominatedLoop.ll | 59 +-
.../NewGVN/2007-07-25-InfiniteLoop.ll | 19 +-
.../test/Transforms/NewGVN/2007-07-25-Loop.ll | 11 +-
.../NewGVN/2007-07-25-NestedLoop.ll | 33 +-
.../NewGVN/2007-07-25-SinglePredecessor.ll | 35 +-
.../NewGVN/2007-07-26-NonRedundant.ll | 11 +-
.../NewGVN/2007-07-26-PhiErasure.ll | 2 +-
.../Transforms/NewGVN/2007-07-30-PredIDom.ll | 221 ++++----
.../NewGVN/2007-07-31-RedundantPhi.ll | 30 +-
.../Transforms/NewGVN/2008-02-13-NewPHI.ll | 21 +-
.../NewGVN/2008-07-02-Unreachable.ll | 52 +-
.../NewGVN/2008-12-09-SelfRemove.ll | 49 +-
.../Transforms/NewGVN/2008-12-12-RLE-Crash.ll | 33 +-
.../NewGVN/2008-12-14-rle-reanalyze.ll | 13 +-
.../NewGVN/2008-12-15-CacheVisited.ll | 23 +-
.../NewGVN/2009-01-21-SortInvalidation.ll | 51 +-
.../NewGVN/2009-01-22-SortInvalidation.ll | 161 +++---
.../Transforms/NewGVN/2009-03-10-PREOnVoid.ll | 67 +--
.../NewGVN/2009-07-13-MemDepSortFail.ll | 67 +--
.../NewGVN/2009-11-12-MemDepMallocBitCast.ll | 11 +-
.../NewGVN/2010-03-31-RedundantPHIs.ll | 27 +
.../Transforms/NewGVN/2010-05-08-OneBit.ll | 13 +-
.../Transforms/NewGVN/2010-11-13-Simplify.ll | 10 +-
.../NewGVN/2011-04-27-phioperands.ll | 27 +-
.../2011-07-07-MatchIntrinsicExtract.ll | 91 ++-
.../Transforms/NewGVN/2011-09-07-TypeIdFor.ll | 60 +-
.../Transforms/NewGVN/2012-05-22-PreCrash.ll | 1 +
...-MaskedScatterGather-xfail-inseltpoison.ll | 20 +
.../Transforms/NewGVN/MemdepMiscompile.ll | 39 +-
llvm/test/Transforms/NewGVN/addrspacecast.ll | 12 +-
.../Transforms/NewGVN/basic-cyclic-opt.ll | 2 +-
.../Transforms/NewGVN/basic-undef-test.ll | 12 +-
llvm/test/Transforms/NewGVN/br-identical.ll | 25 +-
.../Transforms/NewGVN/calloc-load-removal.ll | 8 +-
llvm/test/Transforms/NewGVN/calls-readonly.ll | 32 +-
llvm/test/Transforms/NewGVN/completeness.ll | 62 ++-
llvm/test/Transforms/NewGVN/cond_br.ll | 35 +-
llvm/test/Transforms/NewGVN/condprop.ll | 10 +-
llvm/test/Transforms/NewGVN/crash-no-aa.ll | 1 +
.../test/Transforms/NewGVN/crash-usecounts.ll | 1 +
llvm/test/Transforms/NewGVN/crash.ll | 7 +-
.../Transforms/NewGVN/cyclic-phi-handling.ll | 12 +-
.../Transforms/NewGVN/dbg-redundant-load.ll | 35 +-
llvm/test/Transforms/NewGVN/edge.ll | 168 ++++--
.../NewGVN/eliminate-callsite-inline.ll | 11 +-
llvm/test/Transforms/NewGVN/equivalent-phi.ll | 14 +-
.../test/Transforms/NewGVN/fold-const-expr.ll | 14 +-
llvm/test/Transforms/NewGVN/fpmath.ll | 53 +-
llvm/test/Transforms/NewGVN/funclet.ll | 30 +-
llvm/test/Transforms/NewGVN/int_sideeffect.ll | 37 +-
.../test/Transforms/NewGVN/invariant.group.ll | 521 ++++++++++++------
.../test/Transforms/NewGVN/invariant.start.ll | 41 +-
.../test/Transforms/NewGVN/lifetime-simple.ll | 13 +-
.../Transforms/NewGVN/load-constant-mem.ll | 8 +-
.../load-from-unreachable-predecessor.ll | 14 +-
llvm/test/Transforms/NewGVN/loadforward.ll | 4 +-
.../Transforms/NewGVN/malloc-load-removal.ll | 43 +-
.../test/Transforms/NewGVN/memory-handling.ll | 134 ++++-
.../Transforms/NewGVN/metadata-nonnull.ll | 2 +-
.../Transforms/NewGVN/metadata-simplify.ll | 24 +-
llvm/test/Transforms/NewGVN/noalias.ll | 38 +-
llvm/test/Transforms/NewGVN/nomemlocation.ll | 16 +-
.../NewGVN/non-integral-pointers.ll | 42 +-
.../Transforms/NewGVN/null-aliases-nothing.ll | 24 +-
.../Transforms/NewGVN/phi-edge-handling.ll | 4 +-
...ed-to-existing-value-then-changes-again.ll | 4 +-
.../NewGVN/phi-translate-partial-alias.ll | 18 +-
llvm/test/Transforms/NewGVN/pr17732.ll | 9 +-
llvm/test/Transforms/NewGVN/pr17852.ll | 1 +
llvm/test/Transforms/NewGVN/pr24397.ll | 1 +
llvm/test/Transforms/NewGVN/pr24426.ll | 9 +-
llvm/test/Transforms/NewGVN/pr25440.ll | 83 ++-
llvm/test/Transforms/NewGVN/pr28562.ll | 9 +-
llvm/test/Transforms/NewGVN/pr31472.ll | 6 +-
llvm/test/Transforms/NewGVN/pr31483.ll | 24 +-
llvm/test/Transforms/NewGVN/pr31491.ll | 10 +-
llvm/test/Transforms/NewGVN/pr31501.ll | 32 +-
llvm/test/Transforms/NewGVN/pr31573.ll | 2 +-
llvm/test/Transforms/NewGVN/pr31594.ll | 10 +-
llvm/test/Transforms/NewGVN/pr31613.ll | 6 +-
llvm/test/Transforms/NewGVN/pr31682.ll | 2 +-
llvm/test/Transforms/NewGVN/pr31758.ll | 2 +-
llvm/test/Transforms/NewGVN/pr32607.ll | 2 +-
llvm/test/Transforms/NewGVN/pr32836.ll | 8 +-
llvm/test/Transforms/NewGVN/pr32838.ll | 8 +-
llvm/test/Transforms/NewGVN/pr32845.ll | 2 +-
llvm/test/Transforms/NewGVN/pr32852.ll | 16 +-
llvm/test/Transforms/NewGVN/pr32897.ll | 2 +-
llvm/test/Transforms/NewGVN/pr32934.ll | 62 ++-
llvm/test/Transforms/NewGVN/pr32945.ll | 21 +-
llvm/test/Transforms/NewGVN/pr32952.ll | 30 +-
llvm/test/Transforms/NewGVN/pr33014.ll | 47 +-
llvm/test/Transforms/NewGVN/pr33086.ll | 47 +-
llvm/test/Transforms/NewGVN/pr33116.ll | 2 +-
llvm/test/Transforms/NewGVN/pr33187.ll | 6 +-
llvm/test/Transforms/NewGVN/pr33196.ll | 57 +-
llvm/test/Transforms/NewGVN/pr33204.ll | 6 +-
llvm/test/Transforms/NewGVN/pr33305.ll | 30 +-
llvm/test/Transforms/NewGVN/pr33367.ll | 24 +-
llvm/test/Transforms/NewGVN/pr34452.ll | 2 +-
.../Transforms/NewGVN/pr42422-phi-of-ops.ll | 4 +-
llvm/test/Transforms/NewGVN/pr43441.ll | 30 +-
llvm/test/Transforms/NewGVN/pre-compare.ll | 23 +
...rve-metadata-for-predicate-replacements.ll | 2 +-
llvm/test/Transforms/NewGVN/readattrs.ll | 10 +-
llvm/test/Transforms/NewGVN/rle-nonlocal.ll | 6 +-
llvm/test/Transforms/NewGVN/rle.ll | 37 +-
llvm/test/Transforms/NewGVN/simp-to-self.ll | 19 +-
.../test/Transforms/NewGVN/stale-loop-info.ll | 25 +-
llvm/test/Transforms/NewGVN/tbaa.ll | 113 ++--
.../NewGVN/unreachable_block_infinite_loop.ll | 7 +-
.../Transforms/NewGVN/verify-memoryphi.ll | 19 +-
.../Transforms/NewGVN/volatile-nonvolatile.ll | 47 +-
113 files changed, 2453 insertions(+), 1255 deletions(-)
diff --git a/llvm/test/Transforms/NewGVN/2007-07-25-DominatedLoop.ll b/llvm/test/Transforms/NewGVN/2007-07-25-DominatedLoop.ll
index 978f061ac4fd87..6f0ef197338c28 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-25-DominatedLoop.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-25-DominatedLoop.ll
@@ -1,86 +1,87 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
- %struct.PerlInterpreter = type { i8 }
+ %struct.PerlInterpreter = type { i8 }
@PL_sv_count = external global i32 ; <ptr> [#uses=2]
define void @perl_destruct(ptr %sv_interp) {
entry:
- br i1 false, label %cond_next25, label %cond_true16
+ br i1 false, label %cond_next25, label %cond_true16
cond_true16: ; preds = %entry
- ret void
+ ret void
cond_next25: ; preds = %entry
- br i1 false, label %cond_next33, label %cond_true32
+ br i1 false, label %cond_next33, label %cond_true32
cond_true32: ; preds = %cond_next25
- ret void
+ ret void
cond_next33: ; preds = %cond_next25
- br i1 false, label %cond_next61, label %cond_true.i46
+ br i1 false, label %cond_next61, label %cond_true.i46
cond_true.i46: ; preds = %cond_next33
- ret void
+ ret void
cond_next61: ; preds = %cond_next33
- br i1 false, label %cond_next69, label %cond_true66
+ br i1 false, label %cond_next69, label %cond_true66
cond_true66: ; preds = %cond_next61
- ret void
+ ret void
cond_next69: ; preds = %cond_next61
- br i1 false, label %Perl_safefree.exit52, label %cond_true.i50
+ br i1 false, label %Perl_safefree.exit52, label %cond_true.i50
cond_true.i50: ; preds = %cond_next69
- ret void
+ ret void
Perl_safefree.exit52: ; preds = %cond_next69
- br i1 false, label %cond_next80, label %cond_true77
+ br i1 false, label %cond_next80, label %cond_true77
cond_true77: ; preds = %Perl_safefree.exit52
- ret void
+ ret void
cond_next80: ; preds = %Perl_safefree.exit52
- br i1 false, label %Perl_safefree.exit56, label %cond_true.i54
+ br i1 false, label %Perl_safefree.exit56, label %cond_true.i54
cond_true.i54: ; preds = %cond_next80
- ret void
+ ret void
Perl_safefree.exit56: ; preds = %cond_next80
- br i1 false, label %Perl_safefree.exit60, label %cond_true.i58
+ br i1 false, label %Perl_safefree.exit60, label %cond_true.i58
cond_true.i58: ; preds = %Perl_safefree.exit56
- ret void
+ ret void
Perl_safefree.exit60: ; preds = %Perl_safefree.exit56
- br i1 false, label %Perl_safefree.exit64, label %cond_true.i62
+ br i1 false, label %Perl_safefree.exit64, label %cond_true.i62
cond_true.i62: ; preds = %Perl_safefree.exit60
- ret void
+ ret void
Perl_safefree.exit64: ; preds = %Perl_safefree.exit60
- br i1 false, label %Perl_safefree.exit68, label %cond_true.i66
+ br i1 false, label %Perl_safefree.exit68, label %cond_true.i66
cond_true.i66: ; preds = %Perl_safefree.exit64
- ret void
+ ret void
Perl_safefree.exit68: ; preds = %Perl_safefree.exit64
- br i1 false, label %cond_next150, label %cond_true23.i
+ br i1 false, label %cond_next150, label %cond_true23.i
cond_true23.i: ; preds = %Perl_safefree.exit68
- ret void
+ ret void
cond_next150: ; preds = %Perl_safefree.exit68
- %tmp16092 = load i32, ptr @PL_sv_count, align 4 ; <i32> [#uses=0]
- br label %cond_next165
+ %tmp16092 = load i32, ptr @PL_sv_count, align 4 ; <i32> [#uses=0]
+ br label %cond_next165
bb157: ; preds = %cond_next165
- %tmp158 = load i32, ptr @PL_sv_count, align 4 ; <i32> [#uses=0]
- br label %cond_next165
+ %tmp158 = load i32, ptr @PL_sv_count, align 4 ; <i32> [#uses=0]
+ br label %cond_next165
cond_next165: ; preds = %bb157, %cond_next150
- br i1 false, label %bb171, label %bb157
+ br i1 false, label %bb171, label %bb157
bb171: ; preds = %cond_next165
- ret void
+ ret void
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-25-InfiniteLoop.ll b/llvm/test/Transforms/NewGVN/2007-07-25-InfiniteLoop.ll
index abb6fbe5030f71..5202a2bc6466b9 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-25-InfiniteLoop.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-25-InfiniteLoop.ll
@@ -1,15 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
- %struct.INT2 = type { i32, i32 }
+ %struct.INT2 = type { i32, i32 }
@blkshifts = external global ptr ; <ptr> [#uses=2]
define i32 @xcompact() {
+; CHECK-LABEL: define i32 @xcompact() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store ptr null, ptr @blkshifts, align 4
+; CHECK-NEXT: br label [[BB:%.*]]
+; CHECK: bb:
+; CHECK-NEXT: br label [[BB]]
+;
entry:
- store ptr null, ptr @blkshifts, align 4
- br label %bb
+ store ptr null, ptr @blkshifts, align 4
+ br label %bb
bb: ; preds = %bb, %entry
- %tmp10 = load ptr, ptr @blkshifts, align 4 ; <ptr> [#uses=0]
-; CHECK-NOT: %tmp10
- br label %bb
+ %tmp10 = load ptr, ptr @blkshifts, align 4 ; <ptr> [#uses=0]
+ br label %bb
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-25-Loop.ll b/llvm/test/Transforms/NewGVN/2007-07-25-Loop.ll
index 336f390459b94c..2ee599c11d4199 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-25-Loop.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-25-Loop.ll
@@ -1,15 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
- %struct.s_segment_inf = type { float, i32, i16, i16, float, float, i32, float, float }
+ %struct.s_segment_inf = type { float, i32, i16, i16, float, float, i32, float, float }
define void @print_arch(ptr %arch_file, i32 %route_type, i64 %det_routing_arch.0.0, i64 %det_routing_arch.0.1, i64 %det_routing_arch.0.2, i64 %det_routing_arch.0.3, i64 %det_routing_arch.0.4, ptr %segment_inf, i64 %timing_inf.0.0, i64 %timing_inf.0.1, i64 %timing_inf.0.2, i64 %timing_inf.0.3, i64 %timing_inf.0.4, i32 %timing_inf.1) {
entry:
- br i1 false, label %bb278, label %bb344
+ br i1 false, label %bb278, label %bb344
bb278: ; preds = %bb278, %entry
- br i1 false, label %bb278, label %bb344
+ br i1 false, label %bb278, label %bb344
bb344: ; preds = %bb278, %entry
- %tmp38758 = load i16, ptr null, align 2 ; <i16> [#uses=0]
- ret void
+ %tmp38758 = load i16, ptr null, align 2 ; <i16> [#uses=0]
+ ret void
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-25-NestedLoop.ll b/llvm/test/Transforms/NewGVN/2007-07-25-NestedLoop.ll
index c46f2b7630aca9..e7461c2f32bf88 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-25-NestedLoop.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-25-NestedLoop.ll
@@ -1,38 +1,39 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
- %struct.TypHeader = type { i32, ptr, [3 x i8], i8 }
+ %struct.TypHeader = type { i32, ptr, [3 x i8], i8 }
define ptr @LtRec(ptr %hdL, ptr %hdR) {
entry:
- br i1 false, label %bb556.preheader, label %bb534.preheader
+ br i1 false, label %bb556.preheader, label %bb534.preheader
bb534.preheader: ; preds = %entry
- ret ptr null
+ ret ptr null
bb556.preheader: ; preds = %entry
- %tmp56119 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
- %tmp56220 = load i32, ptr %tmp56119 ; <i32> [#uses=0]
- br i1 false, label %bb.nph23, label %bb675.preheader
+ %tmp56119 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
+ %tmp56220 = load i32, ptr %tmp56119 ; <i32> [#uses=0]
+ br i1 false, label %bb.nph23, label %bb675.preheader
bb.nph23: ; preds = %bb556.preheader
- ret ptr null
+ ret ptr null
bb656: ; preds = %bb675.outer, %bb656
- %tmp678 = load i32, ptr %tmp677 ; <i32> [#uses=0]
- br i1 false, label %bb684, label %bb656
+ %tmp678 = load i32, ptr %tmp677 ; <i32> [#uses=0]
+ br i1 false, label %bb684, label %bb656
bb684: ; preds = %bb675.outer, %bb656
- br i1 false, label %bb924.preheader, label %bb675.outer
+ br i1 false, label %bb924.preheader, label %bb675.outer
bb675.outer: ; preds = %bb675.preheader, %bb684
- %tmp67812 = load i32, ptr %tmp67711 ; <i32> [#uses=0]
- br i1 false, label %bb684, label %bb656
+ %tmp67812 = load i32, ptr %tmp67711 ; <i32> [#uses=0]
+ br i1 false, label %bb684, label %bb656
bb675.preheader: ; preds = %bb556.preheader
- %tmp67711 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
- %tmp677 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
- br label %bb675.outer
+ %tmp67711 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
+ %tmp677 = getelementptr %struct.TypHeader, ptr %hdR, i32 0, i32 0 ; <ptr> [#uses=1]
+ br label %bb675.outer
bb924.preheader: ; preds = %bb684
- ret ptr null
+ ret ptr null
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-25-SinglePredecessor.ll b/llvm/test/Transforms/NewGVN/2007-07-25-SinglePredecessor.ll
index 0b0597f44ee7ea..6fafce30475698 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-25-SinglePredecessor.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-25-SinglePredecessor.ll
@@ -1,29 +1,30 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
- %struct.ggBRDF = type { ptr }
- %struct.ggBox3 = type { %struct.ggPoint3, %struct.ggPoint3 }
- %struct.ggMaterialRecord = type { %struct.ggPoint2, %struct.ggBox3, %struct.ggBox3, %struct.ggSpectrum, %struct.ggSpectrum, %struct.ggSpectrum, ptr, i32, i32, i32, i32 }
- %struct.ggONB3 = type { %struct.ggPoint3, %struct.ggPoint3, %struct.ggPoint3 }
- %struct.ggPoint2 = type { [2 x double] }
- %struct.ggPoint3 = type { [3 x double] }
- %struct.ggSpectrum = type { [8 x float] }
- %struct.mrViewingHitRecord = type { double, %struct.ggPoint3, %struct.ggONB3, %struct.ggPoint2, double, %struct.ggSpectrum, %struct.ggSpectrum, i32, i32, i32, i32 }
- %struct.mrXEllipticalCylinder = type { %struct.ggBRDF, float, float, float, float, float, float }
+ %struct.ggBRDF = type { ptr }
+ %struct.ggBox3 = type { %struct.ggPoint3, %struct.ggPoint3 }
+ %struct.ggMaterialRecord = type { %struct.ggPoint2, %struct.ggBox3, %struct.ggBox3, %struct.ggSpectrum, %struct.ggSpectrum, %struct.ggSpectrum, ptr, i32, i32, i32, i32 }
+ %struct.ggONB3 = type { %struct.ggPoint3, %struct.ggPoint3, %struct.ggPoint3 }
+ %struct.ggPoint2 = type { [2 x double] }
+ %struct.ggPoint3 = type { [3 x double] }
+ %struct.ggSpectrum = type { [8 x float] }
+ %struct.mrViewingHitRecord = type { double, %struct.ggPoint3, %struct.ggONB3, %struct.ggPoint2, double, %struct.ggSpectrum, %struct.ggSpectrum, i32, i32, i32, i32 }
+ %struct.mrXEllipticalCylinder = type { %struct.ggBRDF, float, float, float, float, float, float }
define i32 @_ZNK21mrZEllipticalCylinder10viewingHitERK6ggRay3dddR18mrViewingHitRecordR16ggMaterialRecord(ptr %this, ptr %ray, double %unnamed_arg, double %tmin, double %tmax, ptr %VHR, ptr %unnamed_arg2) {
entry:
- %tmp80.i = getelementptr %struct.mrViewingHitRecord, ptr %VHR, i32 0, i32 1, i32 0, i32 0 ; <ptr> [#uses=1]
- store double 0.000000e+00, ptr %tmp80.i
- br i1 false, label %return, label %cond_next.i
+ %tmp80.i = getelementptr %struct.mrViewingHitRecord, ptr %VHR, i32 0, i32 1, i32 0, i32 0 ; <ptr> [#uses=1]
+ store double 0.000000e+00, ptr %tmp80.i
+ br i1 false, label %return, label %cond_next.i
cond_next.i: ; preds = %entry
- br i1 false, label %return, label %cond_true
+ br i1 false, label %return, label %cond_true
cond_true: ; preds = %cond_next.i
- %tmp3.i8 = getelementptr %struct.mrViewingHitRecord, ptr %VHR, i32 0, i32 1, i32 0, i32 0 ; <ptr> [#uses=1]
- %tmp46 = load double, ptr %tmp3.i8 ; <double> [#uses=0]
- ret i32 1
+ %tmp3.i8 = getelementptr %struct.mrViewingHitRecord, ptr %VHR, i32 0, i32 1, i32 0, i32 0 ; <ptr> [#uses=1]
+ %tmp46 = load double, ptr %tmp3.i8 ; <double> [#uses=0]
+ ret i32 1
return: ; preds = %cond_next.i, %entry
- ret i32 0
+ ret i32 0
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-26-NonRedundant.ll b/llvm/test/Transforms/NewGVN/2007-07-26-NonRedundant.ll
index 8d3bfcd1367bf5..a64901e71b05a5 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-26-NonRedundant.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-26-NonRedundant.ll
@@ -1,16 +1,17 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
@bsLive = external global i32 ; <ptr> [#uses=2]
define i32 @bsR(i32 %n) {
entry:
- br i1 false, label %cond_next, label %bb19
+ br i1 false, label %cond_next, label %bb19
cond_next: ; preds = %entry
- store i32 0, ptr @bsLive, align 4
- br label %bb19
+ store i32 0, ptr @bsLive, align 4
+ br label %bb19
bb19: ; preds = %cond_next, %entry
- %tmp29 = load i32, ptr @bsLive, align 4 ; <i32> [#uses=0]
- ret i32 0
+ %tmp29 = load i32, ptr @bsLive, align 4 ; <i32> [#uses=0]
+ ret i32 0
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-26-PhiErasure.ll b/llvm/test/Transforms/NewGVN/2007-07-26-PhiErasure.ll
index 22d64324c2352e..46f9b84a7e3783 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-26-PhiErasure.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-26-PhiErasure.ll
@@ -20,7 +20,7 @@ define i32 @reload(ptr %first, i32 %global, ptr %dumpfile) {
; CHECK: cond_next2943:
; CHECK-NEXT: br i1 false, label [[BB2982_PREHEADER:%.*]], label [[BB2928]]
; CHECK: bb2982.preheader:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: ret i32 poison
;
cond_next2835.1: ; preds = %cond_next2861
diff --git a/llvm/test/Transforms/NewGVN/2007-07-30-PredIDom.ll b/llvm/test/Transforms/NewGVN/2007-07-30-PredIDom.ll
index 59da31c5e33e05..c70846054caf5a 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-30-PredIDom.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-30-PredIDom.ll
@@ -1,274 +1,275 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
- %"struct.Block::$_16" = type { i32 }
- %struct.Exp = type { ptr, i32, i32, i32, ptr, ptr, %"struct.Exp::$_10", %"struct.Block::$_16", %"struct.Exp::$_12" }
- %"struct.Exp::$_10" = type { ptr }
- %"struct.Exp::$_12" = type { ptr }
- %struct.Exp_ = type { i32, i32, i32, i32, ptr }
- %struct.Id = type { ptr, i32, i32, i32, %"struct.Id::$_13" }
- %"struct.Id::$_13" = type { double }
+ %"struct.Block::$_16" = type { i32 }
+ %struct.Exp = type { ptr, i32, i32, i32, ptr, ptr, %"struct.Exp::$_10", %"struct.Block::$_16", %"struct.Exp::$_12" }
+ %"struct.Exp::$_10" = type { ptr }
+ %"struct.Exp::$_12" = type { ptr }
+ %struct.Exp_ = type { i32, i32, i32, i32, ptr }
+ %struct.Id = type { ptr, i32, i32, i32, %"struct.Id::$_13" }
+ %"struct.Id::$_13" = type { double }
define ptr @_ZN3Exp8toStringEj(ptr %this, i32 %nextpc) {
entry:
- switch i32 0, label %bb970 [
- i32 1, label %bb
- i32 2, label %bb39
- i32 3, label %bb195
- i32 4, label %bb270
- i32 5, label %bb418
- i32 6, label %bb633
- i32 7, label %bb810
- i32 8, label %bb882
- i32 9, label %bb925
- ]
+ switch i32 0, label %bb970 [
+ i32 1, label %bb
+ i32 2, label %bb39
+ i32 3, label %bb195
+ i32 4, label %bb270
+ i32 5, label %bb418
+ i32 6, label %bb633
+ i32 7, label %bb810
+ i32 8, label %bb882
+ i32 9, label %bb925
+ ]
bb: ; preds = %entry
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb39: ; preds = %entry
- br i1 false, label %cond_true, label %cond_false132
+ br i1 false, label %cond_true, label %cond_false132
cond_true: ; preds = %bb39
- br i1 false, label %cond_true73, label %cond_false
+ br i1 false, label %cond_true73, label %cond_false
cond_true73: ; preds = %cond_true
- br i1 false, label %cond_true108, label %cond_next
+ br i1 false, label %cond_true108, label %cond_next
cond_true108: ; preds = %cond_true73
- br label %cond_next
+ br label %cond_next
cond_next: ; preds = %cond_true108, %cond_true73
- br label %cond_next131
+ br label %cond_next131
cond_false: ; preds = %cond_true
- br label %cond_next131
+ br label %cond_next131
cond_next131: ; preds = %cond_false, %cond_next
- br label %cond_next141
+ br label %cond_next141
cond_false132: ; preds = %bb39
- br label %cond_next141
+ br label %cond_next141
cond_next141: ; preds = %cond_false132, %cond_next131
- br i1 false, label %cond_true169, label %cond_false175
+ br i1 false, label %cond_true169, label %cond_false175
cond_true169: ; preds = %cond_next141
- br label %cond_next181
+ br label %cond_next181
cond_false175: ; preds = %cond_next141
- br label %cond_next181
+ br label %cond_next181
cond_next181: ; preds = %cond_false175, %cond_true169
- br i1 false, label %cond_true189, label %cond_next191
+ br i1 false, label %cond_true189, label %cond_next191
cond_true189: ; preds = %cond_next181
- br label %cond_next191
+ br label %cond_next191
cond_next191: ; preds = %cond_true189, %cond_next181
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb195: ; preds = %entry
- br i1 false, label %cond_true248, label %cond_false250
+ br i1 false, label %cond_true248, label %cond_false250
cond_true248: ; preds = %bb195
- br label %cond_next252
+ br label %cond_next252
cond_false250: ; preds = %bb195
- br label %cond_next252
+ br label %cond_next252
cond_next252: ; preds = %cond_false250, %cond_true248
- br i1 false, label %cond_true265, label %cond_next267
+ br i1 false, label %cond_true265, label %cond_next267
cond_true265: ; preds = %cond_next252
- br label %cond_next267
+ br label %cond_next267
cond_next267: ; preds = %cond_true265, %cond_next252
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb270: ; preds = %entry
- br i1 false, label %cond_true338, label %cond_false340
+ br i1 false, label %cond_true338, label %cond_false340
cond_true338: ; preds = %bb270
- br label %cond_next342
+ br label %cond_next342
cond_false340: ; preds = %bb270
- br label %cond_next342
+ br label %cond_next342
cond_next342: ; preds = %cond_false340, %cond_true338
- br i1 false, label %cond_true362, label %cond_false364
+ br i1 false, label %cond_true362, label %cond_false364
cond_true362: ; preds = %cond_next342
- br label %cond_next366
+ br label %cond_next366
cond_false364: ; preds = %cond_next342
- br label %cond_next366
+ br label %cond_next366
cond_next366: ; preds = %cond_false364, %cond_true362
- br i1 false, label %cond_true393, label %cond_next395
+ br i1 false, label %cond_true393, label %cond_next395
cond_true393: ; preds = %cond_next366
- br label %cond_next395
+ br label %cond_next395
cond_next395: ; preds = %cond_true393, %cond_next366
- br i1 false, label %cond_true406, label %cond_next408
+ br i1 false, label %cond_true406, label %cond_next408
cond_true406: ; preds = %cond_next395
- br label %cond_next408
+ br label %cond_next408
cond_next408: ; preds = %cond_true406, %cond_next395
- br i1 false, label %cond_true413, label %cond_next415
+ br i1 false, label %cond_true413, label %cond_next415
cond_true413: ; preds = %cond_next408
- br label %cond_next415
+ br label %cond_next415
cond_next415: ; preds = %cond_true413, %cond_next408
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb418: ; preds = %entry
- br i1 false, label %cond_true512, label %cond_false514
+ br i1 false, label %cond_true512, label %cond_false514
cond_true512: ; preds = %bb418
- br label %cond_next516
+ br label %cond_next516
cond_false514: ; preds = %bb418
- br label %cond_next516
+ br label %cond_next516
cond_next516: ; preds = %cond_false514, %cond_true512
- br i1 false, label %cond_true536, label %cond_false538
+ br i1 false, label %cond_true536, label %cond_false538
cond_true536: ; preds = %cond_next516
- br label %cond_next540
+ br label %cond_next540
cond_false538: ; preds = %cond_next516
- br label %cond_next540
+ br label %cond_next540
cond_next540: ; preds = %cond_false538, %cond_true536
- br i1 false, label %cond_true560, label %cond_false562
+ br i1 false, label %cond_true560, label %cond_false562
cond_true560: ; preds = %cond_next540
- br label %cond_next564
+ br label %cond_next564
cond_false562: ; preds = %cond_next540
- br label %cond_next564
+ br label %cond_next564
cond_next564: ; preds = %cond_false562, %cond_true560
- br i1 false, label %cond_true597, label %cond_next599
+ br i1 false, label %cond_true597, label %cond_next599
cond_true597: ; preds = %cond_next564
- br label %cond_next599
+ br label %cond_next599
cond_next599: ; preds = %cond_true597, %cond_next564
- br i1 false, label %cond_true614, label %cond_next616
+ br i1 false, label %cond_true614, label %cond_next616
cond_true614: ; preds = %cond_next599
- br label %cond_next616
+ br label %cond_next616
cond_next616: ; preds = %cond_true614, %cond_next599
- br i1 false, label %cond_true621, label %cond_next623
+ br i1 false, label %cond_true621, label %cond_next623
cond_true621: ; preds = %cond_next616
- br label %cond_next623
+ br label %cond_next623
cond_next623: ; preds = %cond_true621, %cond_next616
- br i1 false, label %cond_true628, label %cond_next630
+ br i1 false, label %cond_true628, label %cond_next630
cond_true628: ; preds = %cond_next623
- br label %cond_next630
+ br label %cond_next630
cond_next630: ; preds = %cond_true628, %cond_next623
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb633: ; preds = %entry
- br i1 false, label %cond_true667, label %cond_next669
+ br i1 false, label %cond_true667, label %cond_next669
cond_true667: ; preds = %bb633
- br label %cond_next669
+ br label %cond_next669
cond_next669: ; preds = %cond_true667, %bb633
- br i1 false, label %cond_true678, label %cond_next791
+ br i1 false, label %cond_true678, label %cond_next791
cond_true678: ; preds = %cond_next669
- br label %bb735
+ br label %bb735
bb679: ; preds = %bb735
- br i1 false, label %cond_true729, label %cond_next731
+ br i1 false, label %cond_true729, label %cond_next731
cond_true729: ; preds = %bb679
- br label %cond_next731
+ br label %cond_next731
cond_next731: ; preds = %cond_true729, %bb679
- br label %bb735
+ br label %bb735
bb735: ; preds = %cond_next731, %cond_true678
- br i1 false, label %bb679, label %bb743
+ br i1 false, label %bb679, label %bb743
bb743: ; preds = %bb735
- br i1 false, label %cond_true788, label %cond_next790
+ br i1 false, label %cond_true788, label %cond_next790
cond_true788: ; preds = %bb743
- br label %cond_next790
+ br label %cond_next790
cond_next790: ; preds = %cond_true788, %bb743
- br label %cond_next791
+ br label %cond_next791
cond_next791: ; preds = %cond_next790, %cond_next669
- br i1 false, label %cond_true805, label %cond_next807
+ br i1 false, label %cond_true805, label %cond_next807
cond_true805: ; preds = %cond_next791
- br label %cond_next807
+ br label %cond_next807
cond_next807: ; preds = %cond_true805, %cond_next791
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb810: ; preds = %entry
- br i1 false, label %cond_true870, label %cond_next872
+ br i1 false, label %cond_true870, label %cond_next872
cond_true870: ; preds = %bb810
- br label %cond_next872
+ br label %cond_next872
cond_next872: ; preds = %cond_true870, %bb810
- br i1 false, label %cond_true877, label %cond_next879
+ br i1 false, label %cond_true877, label %cond_next879
cond_true877: ; preds = %cond_next872
- br label %cond_next879
+ br label %cond_next879
cond_next879: ; preds = %cond_true877, %cond_next872
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb882: ; preds = %entry
- br i1 false, label %cond_true920, label %cond_next922
+ br i1 false, label %cond_true920, label %cond_next922
cond_true920: ; preds = %bb882
- br label %cond_next922
+ br label %cond_next922
cond_next922: ; preds = %cond_true920, %bb882
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb925: ; preds = %entry
- br i1 false, label %cond_true965, label %cond_next967
+ br i1 false, label %cond_true965, label %cond_next967
cond_true965: ; preds = %bb925
- br label %cond_next967
+ br label %cond_next967
cond_next967: ; preds = %cond_true965, %bb925
- store ptr null, ptr null
- br label %return
+ store ptr null, ptr null
+ br label %return
bb970: ; preds = %entry
- unreachable
- ; No predecessors!
- store ptr null, ptr null
- br label %return
+ unreachable
+ ; No predecessors!
+ store ptr null, ptr null
+ br label %return
return: ; preds = %0, %cond_next967, %cond_next922, %cond_next879, %cond_next807, %cond_next630, %cond_next415, %cond_next267, %cond_next191, %bb
- %retval980 = load ptr, ptr null ; <ptr> [#uses=1]
- ret ptr %retval980
+ %retval980 = load ptr, ptr null ; <ptr> [#uses=1]
+ ret ptr %retval980
}
diff --git a/llvm/test/Transforms/NewGVN/2007-07-31-RedundantPhi.ll b/llvm/test/Transforms/NewGVN/2007-07-31-RedundantPhi.ll
index 934fffc986f815..5411bcc7d406ad 100644
--- a/llvm/test/Transforms/NewGVN/2007-07-31-RedundantPhi.ll
+++ b/llvm/test/Transforms/NewGVN/2007-07-31-RedundantPhi.ll
@@ -1,23 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
@img_width = external global i16 ; <ptr> [#uses=2]
define i32 @smpUMHEXBipredIntegerPelBlockMotionSearch(ptr %cur_pic, i16 signext %ref, i32 %list, i32 %pic_pix_x, i32 %pic_pix_y, i32 %blocktype, i16 signext %pred_mv_x1, i16 signext %pred_mv_y1, i16 signext %pred_mv_x2, i16 signext %pred_mv_y2, ptr %mv_x, ptr %mv_y, ptr %s_mv_x, ptr %s_mv_y, i32 %search_range, i32 %min_mcost, i32 %lambda_factor) {
+; CHECK-LABEL: define i32 @smpUMHEXBipredIntegerPelBlockMotionSearch(
+; CHECK-SAME: ptr [[CUR_PIC:%.*]], i16 signext [[REF:%.*]], i32 [[LIST:%.*]], i32 [[PIC_PIX_X:%.*]], i32 [[PIC_PIX_Y:%.*]], i32 [[BLOCKTYPE:%.*]], i16 signext [[PRED_MV_X1:%.*]], i16 signext [[PRED_MV_Y1:%.*]], i16 signext [[PRED_MV_X2:%.*]], i16 signext [[PRED_MV_Y2:%.*]], ptr [[MV_X:%.*]], ptr [[MV_Y:%.*]], ptr [[S_MV_X:%.*]], ptr [[S_MV_Y:%.*]], i32 [[SEARCH_RANGE:%.*]], i32 [[MIN_MCOST:%.*]], i32 [[LAMBDA_FACTOR:%.*]]) {
+; CHECK-NEXT: cond_next143:
+; CHECK-NEXT: store i16 0, ptr @img_width, align 2
+; CHECK-NEXT: br i1 false, label [[COND_NEXT449:%.*]], label [[COND_FALSE434:%.*]]
+; CHECK: cond_false434:
+; CHECK-NEXT: br label [[COND_NEXT449]]
+; CHECK: cond_next449:
+; CHECK-NEXT: br i1 false, label [[COND_NEXT698:%.*]], label [[COND_FALSE470:%.*]]
+; CHECK: cond_false470:
+; CHECK-NEXT: br label [[COND_NEXT698]]
+; CHECK: cond_next698:
+; CHECK-NEXT: ret i32 0
+;
cond_next143: ; preds = %entry
- store i16 0, ptr @img_width, align 2
- br i1 false, label %cond_next449, label %cond_false434
+ store i16 0, ptr @img_width, align 2
+ br i1 false, label %cond_next449, label %cond_false434
cond_false434: ; preds = %cond_true415
- br label %cond_next449
+ br label %cond_next449
cond_next449: ; preds = %cond_false434, %cond_true415
- br i1 false, label %cond_next698, label %cond_false470
+ br i1 false, label %cond_next698, label %cond_false470
cond_false470: ; preds = %cond_next449
- br label %cond_next698
+ br label %cond_next698
cond_next698: ; preds = %cond_true492
- %tmp701 = load i16, ptr @img_width, align 2 ; <i16> [#uses=0]
-; CHECK-NOT: %tmp701 =
- ret i32 0
+ %tmp701 = load i16, ptr @img_width, align 2 ; <i16> [#uses=0]
+ ret i32 0
}
diff --git a/llvm/test/Transforms/NewGVN/2008-02-13-NewPHI.ll b/llvm/test/Transforms/NewGVN/2008-02-13-NewPHI.ll
index b2440fbced41f4..49d6de7d7a0f69 100644
--- a/llvm/test/Transforms/NewGVN/2008-02-13-NewPHI.ll
+++ b/llvm/test/Transforms/NewGVN/2008-02-13-NewPHI.ll
@@ -1,22 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn
; PR2032
define i32 @sscal(i32 %n, double %sa1, ptr %sx, i32 %incx) {
entry:
- %sx_addr = alloca ptr ; <ptr> [#uses=3]
- store ptr %sx, ptr %sx_addr, align 4
- br label %bb33
+ %sx_addr = alloca ptr ; <ptr> [#uses=3]
+ store ptr %sx, ptr %sx_addr, align 4
+ br label %bb33
bb: ; preds = %bb33
- %tmp27 = load ptr, ptr %sx_addr, align 4 ; <ptr> [#uses=1]
- store float 0.000000e+00, ptr %tmp27, align 4
- store ptr null, ptr %sx_addr, align 4
- br label %bb33
+ %tmp27 = load ptr, ptr %sx_addr, align 4 ; <ptr> [#uses=1]
+ store float 0.000000e+00, ptr %tmp27, align 4
+ store ptr null, ptr %sx_addr, align 4
+ br label %bb33
bb33: ; preds = %bb, %entry
- br i1 false, label %bb, label %return
+ br i1 false, label %bb, label %return
return: ; preds = %bb33
- %retval59 = load i32, ptr null, align 4 ; <i32> [#uses=1]
- ret i32 %retval59
+ %retval59 = load i32, ptr null, align 4 ; <i32> [#uses=1]
+ ret i32 %retval59
}
diff --git a/llvm/test/Transforms/NewGVN/2008-07-02-Unreachable.ll b/llvm/test/Transforms/NewGVN/2008-07-02-Unreachable.ll
index 0c1891e46d2675..cf591d7e2a79a0 100644
--- a/llvm/test/Transforms/NewGVN/2008-07-02-Unreachable.ll
+++ b/llvm/test/Transforms/NewGVN/2008-07-02-Unreachable.ll
@@ -1,36 +1,62 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
; PR2503
@g_3 = external global i8 ; <ptr> [#uses=2]
define i8 @func_1(i32 %x, i32 %y) nounwind {
+; CHECK-LABEL: define i8 @func_1(
+; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], [[Y]]
+; CHECK-NEXT: br i1 [[CMP]], label [[IFELSE:%.*]], label [[IFTHEN:%.*]]
+; CHECK: ifthen:
+; CHECK-NEXT: br label [[IFEND:%.*]]
+; CHECK: ifelse:
+; CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr @g_3, align 1
+; CHECK-NEXT: store i8 [[TMP3]], ptr [[A]], align 1
+; CHECK-NEXT: br label [[AFTERFOR:%.*]]
+; CHECK: forcond:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br i1 false, label [[AFTERFOR]], label [[FORBODY:%.*]]
+; CHECK: forbody:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[FORINC:%.*]]
+; CHECK: forinc:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[FORCOND:%.*]]
+; CHECK: afterfor:
+; CHECK-NEXT: ret i8 [[TMP3]]
+; CHECK: ifend:
+; CHECK-NEXT: ret i8 0
+;
entry:
%A = alloca i8
- %cmp = icmp eq i32 %x, %y
- br i1 %cmp, label %ifelse, label %ifthen
+ %cmp = icmp eq i32 %x, %y
+ br i1 %cmp, label %ifelse, label %ifthen
ifthen: ; preds = %entry
- br label %ifend
+ br label %ifend
ifelse: ; preds = %entry
- %tmp3 = load i8, ptr @g_3 ; <i8> [#uses=0]
- store i8 %tmp3, ptr %A
- br label %afterfor
+ %tmp3 = load i8, ptr @g_3 ; <i8> [#uses=0]
+ store i8 %tmp3, ptr %A
+ br label %afterfor
forcond: ; preds = %forinc
- br i1 false, label %afterfor, label %forbody
+ br i1 false, label %afterfor, label %forbody
forbody: ; preds = %forcond
- br label %forinc
+ br label %forinc
forinc: ; preds = %forbody
- br label %forcond
+ br label %forcond
afterfor: ; preds = %forcond, %forcond.thread
- %tmp10 = load i8, ptr @g_3 ; <i8> [#uses=0]
- ret i8 %tmp10
-; CHECK: ret i8 %tmp3
+ %tmp10 = load i8, ptr @g_3 ; <i8> [#uses=0]
+ ret i8 %tmp10
ifend: ; preds = %afterfor, %ifthen
- ret i8 0
+ ret i8 0
}
diff --git a/llvm/test/Transforms/NewGVN/2008-12-09-SelfRemove.ll b/llvm/test/Transforms/NewGVN/2008-12-09-SelfRemove.ll
index a2e252d065d2fb..95cb229f17f586 100644
--- a/llvm/test/Transforms/NewGVN/2008-12-09-SelfRemove.ll
+++ b/llvm/test/Transforms/NewGVN/2008-12-09-SelfRemove.ll
@@ -1,38 +1,41 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.5"
- %struct.anon = type { ptr, i32 }
- %struct.d_print_info = type { i32, ptr, i32, i32, ptr, ptr, i32 }
- %struct.d_print_mod = type { ptr, ptr, i32, ptr }
- %struct.d_print_template = type { ptr, ptr }
- %struct.demangle_component = type { i32, { %struct.anon } }
+ %struct.anon = type { ptr, i32 }
+ %struct.d_print_info = type { i32, ptr, i32, i32, ptr, ptr, i32 }
+ %struct.d_print_mod = type { ptr, ptr, i32, ptr }
+ %struct.d_print_template = type { ptr, ptr }
+ %struct.demangle_component = type { i32, { %struct.anon } }
define void @d_print_mod_list(ptr %dpi, ptr %mods, i32 %suffix) nounwind {
+; CHECK-LABEL: define void @d_print_mod_list(
+; CHECK-SAME: ptr [[DPI:%.*]], ptr [[MODS:%.*]], i32 [[SUFFIX:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_D_PRINT_INFO:%.*]], ptr [[DPI]], i32 0, i32 1
+; CHECK-NEXT: br i1 false, label [[RETURN:%.*]], label [[BB:%.*]]
+; CHECK: bb:
+; CHECK-NEXT: br label [[BB21:%.*]]
+; CHECK: bb21:
+; CHECK-NEXT: br label [[BB21]]
+; CHECK: return:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: ret void
+;
entry:
- %0 = getelementptr %struct.d_print_info, ptr %dpi, i32 0, i32 1 ; <ptr> [#uses=1]
- br i1 false, label %return, label %bb
+ %0 = getelementptr %struct.d_print_info, ptr %dpi, i32 0, i32 1 ; <ptr> [#uses=1]
+ br i1 false, label %return, label %bb
bb: ; preds = %entry
- %1 = load ptr, ptr %0, align 4 ; <ptr> [#uses=0]
- %2 = getelementptr %struct.d_print_info, ptr %dpi, i32 0, i32 1 ; <ptr> [#uses=0]
- br label %bb21
+ %1 = load ptr, ptr %0, align 4 ; <ptr> [#uses=0]
+ %2 = getelementptr %struct.d_print_info, ptr %dpi, i32 0, i32 1 ; <ptr> [#uses=0]
+ br label %bb21
bb21: ; preds = %bb21, %bb
- br label %bb21
+ br label %bb21
return: ; preds = %entry
- ret void
+ ret void
}
-; CHECK: define void @d_print_mod_list(ptr %dpi, ptr %mods, i32 %suffix) #0 {
-; CHECK: entry:
-; CHECK: %0 = getelementptr %struct.d_print_info, ptr %dpi, i32 0, i32 1
-; CHECK: br i1 false, label %return, label %bb
-; CHECK: bb:
-; CHECK: br label %bb21
-; CHECK: bb21:
-; CHECK: br label %bb21
-; CHECK: return:
-; CHECK: ret void
-; CHECK: }
diff --git a/llvm/test/Transforms/NewGVN/2008-12-12-RLE-Crash.ll b/llvm/test/Transforms/NewGVN/2008-12-12-RLE-Crash.ll
index bb51f72752a257..3df35a15932837 100644
--- a/llvm/test/Transforms/NewGVN/2008-12-12-RLE-Crash.ll
+++ b/llvm/test/Transforms/NewGVN/2008-12-12-RLE-Crash.ll
@@ -1,35 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin7"
define i32 @main(i32 %argc, ptr %argv) nounwind {
entry:
- br label %bb84
+ br label %bb84
bb41: ; preds = %bb82
- %tmp = load i8, ptr %opt.0, align 1 ; <i8> [#uses=0]
- %tmp1 = getelementptr i8, ptr %opt.0, i32 1 ; <ptr> [#uses=2]
- switch i32 0, label %bb81 [
- i32 102, label %bb82
- i32 110, label %bb79
- i32 118, label %bb80
- ]
+ %tmp = load i8, ptr %opt.0, align 1 ; <i8> [#uses=0]
+ %tmp1 = getelementptr i8, ptr %opt.0, i32 1 ; <ptr> [#uses=2]
+ switch i32 0, label %bb81 [
+ i32 102, label %bb82
+ i32 110, label %bb79
+ i32 118, label %bb80
+ ]
bb79: ; preds = %bb41
- br label %bb82
+ br label %bb82
bb80: ; preds = %bb41
- ret i32 0
+ ret i32 0
bb81: ; preds = %bb41
- ret i32 1
+ ret i32 1
bb82: ; preds = %bb84, %bb79, %bb41
- %opt.0 = phi ptr [ %tmp3, %bb84 ], [ %tmp1, %bb79 ], [ %tmp1, %bb41 ] ; <ptr> [#uses=3]
- %tmp2 = load i8, ptr %opt.0, align 1 ; <i8> [#uses=0]
- br i1 false, label %bb84, label %bb41
+ %opt.0 = phi ptr [ %tmp3, %bb84 ], [ %tmp1, %bb79 ], [ %tmp1, %bb41 ] ; <ptr> [#uses=3]
+ %tmp2 = load i8, ptr %opt.0, align 1 ; <i8> [#uses=0]
+ br i1 false, label %bb84, label %bb41
bb84: ; preds = %bb82, %entry
- %tmp3 = getelementptr i8, ptr null, i32 1 ; <ptr> [#uses=1]
- br label %bb82
+ %tmp3 = getelementptr i8, ptr null, i32 1 ; <ptr> [#uses=1]
+ br label %bb82
}
diff --git a/llvm/test/Transforms/NewGVN/2008-12-14-rle-reanalyze.ll b/llvm/test/Transforms/NewGVN/2008-12-14-rle-reanalyze.ll
index 38d1240fd6a29c..821355664a7f09 100644
--- a/llvm/test/Transforms/NewGVN/2008-12-14-rle-reanalyze.ll
+++ b/llvm/test/Transforms/NewGVN/2008-12-14-rle-reanalyze.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin7"
@@ -5,14 +6,14 @@ target triple = "i386-apple-darwin7"
define i32 @Quiesce(i32 %alpha, i32 %beta, i32 %wtm, i32 %ply) nounwind {
entry:
- br label %bb22
+ br label %bb22
bb22: ; preds = %bb23, %bb22, %entry
- br i1 false, label %bb23, label %bb22
+ br i1 false, label %bb23, label %bb22
bb23: ; preds = %bb23, %bb22
- %sortv.233 = phi ptr [ @sort_value, %bb22 ], [ %sortv.2, %bb23 ] ; <ptr> [#uses=1]
- %0 = load i32, ptr %sortv.233, align 4 ; <i32> [#uses=0]
- %sortv.2 = getelementptr [256 x i32], ptr @sort_value, i32 0, i32 0 ; <ptr> [#uses=1]
- br i1 false, label %bb23, label %bb22
+ %sortv.233 = phi ptr [ @sort_value, %bb22 ], [ %sortv.2, %bb23 ] ; <ptr> [#uses=1]
+ %0 = load i32, ptr %sortv.233, align 4 ; <i32> [#uses=0]
+ %sortv.2 = getelementptr [256 x i32], ptr @sort_value, i32 0, i32 0 ; <ptr> [#uses=1]
+ br i1 false, label %bb23, label %bb22
}
diff --git a/llvm/test/Transforms/NewGVN/2008-12-15-CacheVisited.ll b/llvm/test/Transforms/NewGVN/2008-12-15-CacheVisited.ll
index 0b1761da0c33a1..ff9ecce88b458d 100644
--- a/llvm/test/Transforms/NewGVN/2008-12-15-CacheVisited.ll
+++ b/llvm/test/Transforms/NewGVN/2008-12-15-CacheVisited.ll
@@ -1,28 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
; Cached results must be added to and verified against the visited sets.
; PR3217
define fastcc void @gen_field_die(ptr %decl) nounwind {
entry:
- br i1 false, label %bb203, label %bb202
+ br i1 false, label %bb203, label %bb202
bb202: ; preds = %entry
- unreachable
+ unreachable
bb203: ; preds = %entry
- %tmp = getelementptr i32, ptr %decl, i32 1 ; <ptr> [#uses=1]
- %tmp1 = load i32, ptr %tmp, align 4 ; <i32> [#uses=0]
- br i1 false, label %bb207, label %bb204
+ %tmp = getelementptr i32, ptr %decl, i32 1 ; <ptr> [#uses=1]
+ %tmp1 = load i32, ptr %tmp, align 4 ; <i32> [#uses=0]
+ br i1 false, label %bb207, label %bb204
bb204: ; preds = %bb203
- %tmp2 = getelementptr i32, ptr %decl, i32 1 ; <ptr> [#uses=1]
- br label %bb208
+ %tmp2 = getelementptr i32, ptr %decl, i32 1 ; <ptr> [#uses=1]
+ br label %bb208
bb207: ; preds = %bb203
- br label %bb208
+ br label %bb208
bb208: ; preds = %bb207, %bb204
- %iftmp.1374.0.in = phi ptr [ null, %bb207 ], [ %tmp2, %bb204 ] ; <ptr> [#uses=1]
- %iftmp.1374.0 = load i32, ptr %iftmp.1374.0.in ; <i32> [#uses=0]
- unreachable
+ %iftmp.1374.0.in = phi ptr [ null, %bb207 ], [ %tmp2, %bb204 ] ; <ptr> [#uses=1]
+ %iftmp.1374.0 = load i32, ptr %iftmp.1374.0.in ; <i32> [#uses=0]
+ unreachable
}
diff --git a/llvm/test/Transforms/NewGVN/2009-01-21-SortInvalidation.ll b/llvm/test/Transforms/NewGVN/2009-01-21-SortInvalidation.ll
index 8631cbd82f5d76..1f0a32a8745849 100644
--- a/llvm/test/Transforms/NewGVN/2009-01-21-SortInvalidation.ll
+++ b/llvm/test/Transforms/NewGVN/2009-01-21-SortInvalidation.ll
@@ -1,55 +1,56 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
; PR3358
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"
- %struct.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
- %struct.re_registers = type { i32, ptr, ptr }
+ %struct.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
+ %struct.re_registers = type { i32, ptr, ptr }
define fastcc i32 @byte_re_match_2_internal(ptr nocapture %bufp, ptr %string1, i32 %size1, ptr %string2, i32 %size2, i32 %pos, ptr %regs, i32 %stop) nounwind {
entry:
- br label %bb159
+ br label %bb159
succeed_label: ; preds = %bb159
- ret i32 0
+ ret i32 0
bb159: ; preds = %bb664, %bb554, %bb159, %bb159, %bb159, %entry
- %d.0 = phi ptr [ null, %entry ], [ %d.0, %bb159 ], [ %d.0, %bb554 ], [ %d.0, %bb159 ], [ %d.0, %bb159 ], [ %d.12, %bb664 ] ; <ptr> [#uses=5]
- switch i32 0, label %bb661 [
- i32 0, label %bb159
- i32 1, label %succeed_label
- i32 13, label %bb159
- i32 14, label %bb159
- i32 16, label %bb411
- i32 24, label %bb622
- i32 28, label %bb543
- ]
+ %d.0 = phi ptr [ null, %entry ], [ %d.0, %bb159 ], [ %d.0, %bb554 ], [ %d.0, %bb159 ], [ %d.0, %bb159 ], [ %d.12, %bb664 ] ; <ptr> [#uses=5]
+ switch i32 0, label %bb661 [
+ i32 0, label %bb159
+ i32 1, label %succeed_label
+ i32 13, label %bb159
+ i32 14, label %bb159
+ i32 16, label %bb411
+ i32 24, label %bb622
+ i32 28, label %bb543
+ ]
bb411: ; preds = %bb411, %bb159
- br label %bb411
+ br label %bb411
bb543: ; preds = %bb159
- br i1 false, label %bb549, label %bb550
+ br i1 false, label %bb549, label %bb550
bb549: ; preds = %bb543
- br label %bb554
+ br label %bb554
bb550: ; preds = %bb543
- br i1 false, label %bb554, label %bb552
+ br i1 false, label %bb554, label %bb552
bb552: ; preds = %bb550
- %0 = load i8, ptr %d.0, align 8 ; <i8> [#uses=0]
- br label %bb554
+ %0 = load i8, ptr %d.0, align 8 ; <i8> [#uses=0]
+ br label %bb554
bb554: ; preds = %bb552, %bb550, %bb549
- br i1 false, label %bb159, label %bb661
+ br i1 false, label %bb159, label %bb661
bb622: ; preds = %bb622, %bb159
- br label %bb622
+ br label %bb622
bb661: ; preds = %bb554, %bb159
- %d.12 = select i1 false, ptr null, ptr null ; <ptr> [#uses=1]
- br label %bb664
+ %d.12 = select i1 false, ptr null, ptr null ; <ptr> [#uses=1]
+ br label %bb664
bb664: ; preds = %bb664, %bb661
- br i1 false, label %bb159, label %bb664
+ br i1 false, label %bb159, label %bb664
}
diff --git a/llvm/test/Transforms/NewGVN/2009-01-22-SortInvalidation.ll b/llvm/test/Transforms/NewGVN/2009-01-22-SortInvalidation.ll
index d8871700df6d8b..25f73dc8aa19d2 100644
--- a/llvm/test/Transforms/NewGVN/2009-01-22-SortInvalidation.ll
+++ b/llvm/test/Transforms/NewGVN/2009-01-22-SortInvalidation.ll
@@ -1,100 +1,101 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin7"
- %struct..4sPragmaType = type { ptr, i32 }
- %struct.AggInfo = type { i8, i8, i32, ptr, i32, ptr, i32, i32, i32, ptr, i32, i32 }
- %struct.AggInfo_col = type { ptr, i32, i32, i32, i32, ptr }
- %struct.AggInfo_func = type { ptr, ptr, i32, i32 }
- %struct.AuxData = type { ptr, ptr }
- %struct.Bitvec = type { i32, i32, i32, { [125 x i32] } }
- %struct.BtCursor = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, %struct.CellInfo, i8, i8, ptr, i64, i32, i8, ptr }
- %struct.BtLock = type { ptr, i32, i8, ptr }
- %struct.BtShared = type { ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i32, i16, i16, i32, i32, i32, i32, i8, i32, ptr, ptr, ptr, %struct.BusyHandler, i32, ptr, ptr, ptr }
- %struct.Btree = type { ptr, ptr, i8, i8, i8, i32, ptr, ptr }
- %struct.BtreeMutexArray = type { i32, [11 x ptr] }
- %struct.BusyHandler = type { ptr, ptr, i32 }
- %struct.CellInfo = type { ptr, i64, i32, i32, i16, i16, i16, i16 }
- %struct.CollSeq = type { ptr, i8, i8, ptr, ptr, ptr }
- %struct.Column = type { ptr, ptr, ptr, ptr, i8, i8, i8, i8 }
- %struct.Context = type { i64, i32, %struct.Fifo }
- %struct.CountCtx = type { i64 }
- %struct.Cursor = type { ptr, i32, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i64, ptr, i32, ptr, i64, ptr, ptr, i32, i64, ptr, ptr, i32, i32, ptr, ptr, ptr }
- %struct.Db = type { ptr, ptr, i8, i8, ptr, ptr, ptr }
- %struct.Expr = type { i8, i8, i16, ptr, ptr, ptr, ptr, %struct..4sPragmaType, %struct..4sPragmaType, i32, i32, ptr, i32, i32, ptr, ptr, i32 }
- %struct.ExprList = type { i32, i32, i32, ptr }
- %struct.ExprList_item = type { ptr, ptr, i8, i8, i8 }
- %struct.FKey = type { ptr, ptr, ptr, ptr, i32, ptr, i8, i8, i8, i8 }
- %struct.Fifo = type { i32, ptr, ptr }
- %struct.FifoPage = type { i32, i32, i32, ptr, [1 x i64] }
- %struct.FuncDef = type { i16, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, [1 x i8] }
- %struct.Hash = type { i8, i8, i32, i32, ptr, ptr }
- %struct.HashElem = type { ptr, ptr, ptr, ptr, i32 }
- %struct.IdList = type { ptr, i32, i32 }
- %struct.Index = type { ptr, i32, ptr, ptr, ptr, i32, i8, i8, ptr, ptr, ptr, ptr, ptr }
- %struct.KeyInfo = type { ptr, i8, i8, i8, i32, ptr, [1 x ptr] }
- %struct.Mem = type { %struct.CountCtx, double, ptr, ptr, i32, i16, i8, i8, ptr }
- %struct.MemPage = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i16, i16, i16, [5 x %struct._OvflCell], ptr, ptr, ptr, i32, ptr }
- %struct.Module = type { ptr, ptr, ptr, ptr }
- %struct.Op = type { i8, i8, i8, i8, i32, i32, i32, { i32 } }
- %struct.Pager = type { ptr, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.PagerLruList, ptr, ptr, ptr, i64, i64, i64, i64, i64, i32, ptr, ptr, i32, ptr, ptr, [16 x i8] }
- %struct.PagerLruLink = type { ptr, ptr }
- %struct.PagerLruList = type { ptr, ptr, ptr }
- %struct.Parse = type { ptr, i32, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [12 x i32], i32, ptr, i32, i32, i32, i32, i32, ptr, i8, %struct..4sPragmaType, %struct..4sPragmaType, %struct..4sPragmaType, ptr, ptr, ptr, ptr, ptr, ptr, %struct..4sPragmaType, i8, ptr, i32 }
- %struct.PgHdr = type { ptr, i32, ptr, ptr, %struct.PagerLruLink, ptr, i8, i8, i8, i8, i8, i16, ptr, ptr, ptr }
- %struct.Schema = type { i32, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Hash, ptr, i8, i8, i16, i32, ptr }
- %struct.Select = type { ptr, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, [3 x i32] }
- %struct.SrcList = type { i16, i16, [1 x %struct.SrcList_item] }
- %struct.SrcList_item = type { ptr, ptr, ptr, ptr, ptr, i8, i8, i32, ptr, ptr, i64 }
- %struct.Table = type { ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, i32, ptr, ptr }
- %struct.TableLock = type { i32, i32, i8, ptr }
- %struct.Trigger = type { ptr, ptr, i8, i8, ptr, ptr, %struct..4sPragmaType, ptr, ptr, ptr, ptr }
- %struct.TriggerStack = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr }
- %struct.TriggerStep = type { i32, i32, ptr, ptr, %struct..4sPragmaType, ptr, ptr, ptr, ptr, ptr }
- %struct.Vdbe = type { ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, %struct.Fifo, i32, i32, ptr, i32, i32, i32, i32, i32, [25 x i32], i32, i32, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i32, i64, i32, %struct.BtreeMutexArray, i32, ptr, i32 }
- %struct.VdbeFunc = type { ptr, i32, [1 x %struct.AuxData] }
- %struct._OvflCell = type { ptr, i16 }
- %struct._ht = type { i32, ptr }
- %struct.anon = type { double }
- %struct.sColMap = type { i32, ptr }
- %struct.sqlite3 = type { ptr, i32, ptr, i32, i32, i32, i32, i8, i8, i8, i8, i32, ptr, i64, i64, i32, i32, i32, ptr, %struct.sqlite3InitInfo, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.anon, ptr, ptr, ptr, ptr, i32, %struct.Hash, ptr, ptr, i32, %struct.Hash, %struct.Hash, %struct.BusyHandler, i32, [2 x %struct.Db], i8 }
- %struct.sqlite3InitInfo = type { i32, i32, i8 }
- %struct.sqlite3_context = type { ptr, ptr, %struct.Mem, ptr, i32, ptr }
- %struct.sqlite3_file = type { ptr }
- %struct.sqlite3_index_constraint = type { i32, i8, i8, i32 }
- %struct.sqlite3_index_constraint_usage = type { i32, i8 }
- %struct.sqlite3_index_info = type { i32, ptr, i32, ptr, ptr, i32, ptr, i32, i32, double }
- %struct.sqlite3_io_methods = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
- %struct.sqlite3_module = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
- %struct.sqlite3_mutex = type opaque
- %struct.sqlite3_vfs = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
- %struct.sqlite3_vtab = type { ptr, i32, ptr }
- %struct.sqlite3_vtab_cursor = type { ptr }
+ %struct..4sPragmaType = type { ptr, i32 }
+ %struct.AggInfo = type { i8, i8, i32, ptr, i32, ptr, i32, i32, i32, ptr, i32, i32 }
+ %struct.AggInfo_col = type { ptr, i32, i32, i32, i32, ptr }
+ %struct.AggInfo_func = type { ptr, ptr, i32, i32 }
+ %struct.AuxData = type { ptr, ptr }
+ %struct.Bitvec = type { i32, i32, i32, { [125 x i32] } }
+ %struct.BtCursor = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, %struct.CellInfo, i8, i8, ptr, i64, i32, i8, ptr }
+ %struct.BtLock = type { ptr, i32, i8, ptr }
+ %struct.BtShared = type { ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i32, i16, i16, i32, i32, i32, i32, i8, i32, ptr, ptr, ptr, %struct.BusyHandler, i32, ptr, ptr, ptr }
+ %struct.Btree = type { ptr, ptr, i8, i8, i8, i32, ptr, ptr }
+ %struct.BtreeMutexArray = type { i32, [11 x ptr] }
+ %struct.BusyHandler = type { ptr, ptr, i32 }
+ %struct.CellInfo = type { ptr, i64, i32, i32, i16, i16, i16, i16 }
+ %struct.CollSeq = type { ptr, i8, i8, ptr, ptr, ptr }
+ %struct.Column = type { ptr, ptr, ptr, ptr, i8, i8, i8, i8 }
+ %struct.Context = type { i64, i32, %struct.Fifo }
+ %struct.CountCtx = type { i64 }
+ %struct.Cursor = type { ptr, i32, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i64, ptr, i32, ptr, i64, ptr, ptr, i32, i64, ptr, ptr, i32, i32, ptr, ptr, ptr }
+ %struct.Db = type { ptr, ptr, i8, i8, ptr, ptr, ptr }
+ %struct.Expr = type { i8, i8, i16, ptr, ptr, ptr, ptr, %struct..4sPragmaType, %struct..4sPragmaType, i32, i32, ptr, i32, i32, ptr, ptr, i32 }
+ %struct.ExprList = type { i32, i32, i32, ptr }
+ %struct.ExprList_item = type { ptr, ptr, i8, i8, i8 }
+ %struct.FKey = type { ptr, ptr, ptr, ptr, i32, ptr, i8, i8, i8, i8 }
+ %struct.Fifo = type { i32, ptr, ptr }
+ %struct.FifoPage = type { i32, i32, i32, ptr, [1 x i64] }
+ %struct.FuncDef = type { i16, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, [1 x i8] }
+ %struct.Hash = type { i8, i8, i32, i32, ptr, ptr }
+ %struct.HashElem = type { ptr, ptr, ptr, ptr, i32 }
+ %struct.IdList = type { ptr, i32, i32 }
+ %struct.Index = type { ptr, i32, ptr, ptr, ptr, i32, i8, i8, ptr, ptr, ptr, ptr, ptr }
+ %struct.KeyInfo = type { ptr, i8, i8, i8, i32, ptr, [1 x ptr] }
+ %struct.Mem = type { %struct.CountCtx, double, ptr, ptr, i32, i16, i8, i8, ptr }
+ %struct.MemPage = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i16, i16, i16, [5 x %struct._OvflCell], ptr, ptr, ptr, i32, ptr }
+ %struct.Module = type { ptr, ptr, ptr, ptr }
+ %struct.Op = type { i8, i8, i8, i8, i32, i32, i32, { i32 } }
+ %struct.Pager = type { ptr, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.PagerLruList, ptr, ptr, ptr, i64, i64, i64, i64, i64, i32, ptr, ptr, i32, ptr, ptr, [16 x i8] }
+ %struct.PagerLruLink = type { ptr, ptr }
+ %struct.PagerLruList = type { ptr, ptr, ptr }
+ %struct.Parse = type { ptr, i32, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [12 x i32], i32, ptr, i32, i32, i32, i32, i32, ptr, i8, %struct..4sPragmaType, %struct..4sPragmaType, %struct..4sPragmaType, ptr, ptr, ptr, ptr, ptr, ptr, %struct..4sPragmaType, i8, ptr, i32 }
+ %struct.PgHdr = type { ptr, i32, ptr, ptr, %struct.PagerLruLink, ptr, i8, i8, i8, i8, i8, i16, ptr, ptr, ptr }
+ %struct.Schema = type { i32, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Hash, ptr, i8, i8, i16, i32, ptr }
+ %struct.Select = type { ptr, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, [3 x i32] }
+ %struct.SrcList = type { i16, i16, [1 x %struct.SrcList_item] }
+ %struct.SrcList_item = type { ptr, ptr, ptr, ptr, ptr, i8, i8, i32, ptr, ptr, i64 }
+ %struct.Table = type { ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, i32, ptr, ptr }
+ %struct.TableLock = type { i32, i32, i8, ptr }
+ %struct.Trigger = type { ptr, ptr, i8, i8, ptr, ptr, %struct..4sPragmaType, ptr, ptr, ptr, ptr }
+ %struct.TriggerStack = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr }
+ %struct.TriggerStep = type { i32, i32, ptr, ptr, %struct..4sPragmaType, ptr, ptr, ptr, ptr, ptr }
+ %struct.Vdbe = type { ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, %struct.Fifo, i32, i32, ptr, i32, i32, i32, i32, i32, [25 x i32], i32, i32, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i32, i64, i32, %struct.BtreeMutexArray, i32, ptr, i32 }
+ %struct.VdbeFunc = type { ptr, i32, [1 x %struct.AuxData] }
+ %struct._OvflCell = type { ptr, i16 }
+ %struct._ht = type { i32, ptr }
+ %struct.anon = type { double }
+ %struct.sColMap = type { i32, ptr }
+ %struct.sqlite3 = type { ptr, i32, ptr, i32, i32, i32, i32, i8, i8, i8, i8, i32, ptr, i64, i64, i32, i32, i32, ptr, %struct.sqlite3InitInfo, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.anon, ptr, ptr, ptr, ptr, i32, %struct.Hash, ptr, ptr, i32, %struct.Hash, %struct.Hash, %struct.BusyHandler, i32, [2 x %struct.Db], i8 }
+ %struct.sqlite3InitInfo = type { i32, i32, i8 }
+ %struct.sqlite3_context = type { ptr, ptr, %struct.Mem, ptr, i32, ptr }
+ %struct.sqlite3_file = type { ptr }
+ %struct.sqlite3_index_constraint = type { i32, i8, i8, i32 }
+ %struct.sqlite3_index_constraint_usage = type { i32, i8 }
+ %struct.sqlite3_index_info = type { i32, ptr, i32, ptr, ptr, i32, ptr, i32, i32, double }
+ %struct.sqlite3_io_methods = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
+ %struct.sqlite3_module = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
+ %struct.sqlite3_mutex = type opaque
+ %struct.sqlite3_vfs = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
+ %struct.sqlite3_vtab = type { ptr, i32, ptr }
+ %struct.sqlite3_vtab_cursor = type { ptr }
define fastcc void @sqlite3Insert(ptr %pParse, ptr %pTabList, ptr %pList, ptr %pSelect, ptr %pColumn, i32 %onError) nounwind {
entry:
- br i1 false, label %bb54, label %bb69.loopexit
+ br i1 false, label %bb54, label %bb69.loopexit
bb54: ; preds = %entry
- br label %bb69.loopexit
+ br label %bb69.loopexit
bb59: ; preds = %bb63.preheader
- %0 = load ptr, ptr %3, align 4 ; <ptr> [#uses=0]
- br label %bb65
+ %0 = load ptr, ptr %3, align 4 ; <ptr> [#uses=0]
+ br label %bb65
bb65: ; preds = %bb63.preheader, %bb59
- %1 = load ptr, ptr %4, align 4 ; <ptr> [#uses=0]
- br i1 false, label %bb67, label %bb63.preheader
+ %1 = load ptr, ptr %4, align 4 ; <ptr> [#uses=0]
+ br i1 false, label %bb67, label %bb63.preheader
bb67: ; preds = %bb65
- %2 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=0]
- unreachable
+ %2 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=0]
+ unreachable
bb69.loopexit: ; preds = %bb54, %entry
- %3 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=1]
- %4 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=1]
- br label %bb63.preheader
+ %3 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=1]
+ %4 = getelementptr %struct.IdList, ptr %pColumn, i32 0, i32 0 ; <ptr> [#uses=1]
+ br label %bb63.preheader
bb63.preheader: ; preds = %bb69.loopexit, %bb65
- br i1 false, label %bb59, label %bb65
+ br i1 false, label %bb59, label %bb65
}
diff --git a/llvm/test/Transforms/NewGVN/2009-03-10-PREOnVoid.ll b/llvm/test/Transforms/NewGVN/2009-03-10-PREOnVoid.ll
index 6aa79e0433d486..83177e5498fe83 100644
--- a/llvm/test/Transforms/NewGVN/2009-03-10-PREOnVoid.ll
+++ b/llvm/test/Transforms/NewGVN/2009-03-10-PREOnVoid.ll
@@ -1,21 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -disable-output
; PR3775
; ModuleID = 'bugpoint-reduced-simplified.bc'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
- %llvm.dbg.anchor.type = type { i32, i32 }
- %"struct.__gnu_cxx::hash<ptr>" = type <{ i8 }>
- %struct.__sched_param = type { i32 }
- %struct._pthread_descr_struct = type opaque
- %struct.pthread_attr_t = type { i32, i32, %struct.__sched_param, i32, i32, i32, i32, ptr, i32 }
- %struct.pthread_mutex_t = type { i32, i32, ptr, i32, %llvm.dbg.anchor.type }
- %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >" = type { %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<ptr>,false>" }
- %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<ptr>,false>" = type { %"struct.__gnu_cxx::hash<ptr>", %"struct.std::_Rb_tree_node_base", i32 }
- %"struct.std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >" = type { ptr }
- %"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
- %"struct.std::pair<std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,bool>" = type { %"struct.std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >", i8 }
- %"struct.std::pair<ptr const,ptr>" = type { ptr, ptr }
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %"struct.__gnu_cxx::hash<ptr>" = type <{ i8 }>
+ %struct.__sched_param = type { i32 }
+ %struct._pthread_descr_struct = type opaque
+ %struct.pthread_attr_t = type { i32, i32, %struct.__sched_param, i32, i32, i32, i32, ptr, i32 }
+ %struct.pthread_mutex_t = type { i32, i32, ptr, i32, %llvm.dbg.anchor.type }
+ %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >" = type { %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<ptr>,false>" }
+ %"struct.std::_Rb_tree<ptr,std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<ptr>,std::allocator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<ptr>,false>" = type { %"struct.__gnu_cxx::hash<ptr>", %"struct.std::_Rb_tree_node_base", i32 }
+ %"struct.std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >" = type { ptr }
+ %"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
+ %"struct.std::pair<std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,bool>" = type { %"struct.std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >", i8 }
+ %"struct.std::pair<ptr const,ptr>" = type { ptr, ptr }
@_ZL20__gthrw_pthread_oncePiPFvvE = weak alias i32 (ptr, ptr), ptr @pthread_once ; <ptr> [#uses=0]
@_ZL27__gthrw_pthread_getspecificj = weak alias ptr (i32), ptr @pthread_getspecific ; <ptr> [#uses=0]
@@ -36,75 +37,75 @@ declare fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind readnone
define fastcc void @_ZNSt8_Rb_treeIPvSt4pairIKS0_S0_ESt10_Select1stIS3_ESt4lessIS0_ESaIS3_EE16_M_insert_uniqueERKS3_(ptr noalias nocapture sret(%"struct.std::pair<std::_Rb_tree_iterator<std::pair<ptr const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,bool>") %agg.result, ptr %this, ptr %__v) nounwind {
entry:
- br i1 false, label %bb7, label %bb
+ br i1 false, label %bb7, label %bb
bb: ; preds = %bb, %entry
- br i1 false, label %bb5, label %bb
+ br i1 false, label %bb5, label %bb
bb5: ; preds = %bb
- call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
- br i1 false, label %bb11, label %bb7
+ call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
+ br i1 false, label %bb11, label %bb7
bb7: ; preds = %bb5, %entry
- br label %bb11
+ br label %bb11
bb11: ; preds = %bb7, %bb5
- call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
- unreachable
+ call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
+ unreachable
}
define i32 @pthread_once(ptr, ptr) {
- ret i32 0
+ ret i32 0
}
define ptr @pthread_getspecific(i32) {
- ret ptr null
+ ret ptr null
}
define i32 @pthread_setspecific(i32, ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_create(ptr, ptr, ptr, ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_cancel(i32) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutex_lock(ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutex_trylock(ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutex_unlock(ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutex_init(ptr, ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_key_create(ptr, ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_key_delete(i32) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutexattr_init(ptr) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutexattr_settype(ptr, i32) {
- ret i32 0
+ ret i32 0
}
define i32 @pthread_mutexattr_destroy(ptr) {
- ret i32 0
+ ret i32 0
}
diff --git a/llvm/test/Transforms/NewGVN/2009-07-13-MemDepSortFail.ll b/llvm/test/Transforms/NewGVN/2009-07-13-MemDepSortFail.ll
index 24ad1852780cdb..9694ae47e977c5 100644
--- a/llvm/test/Transforms/NewGVN/2009-07-13-MemDepSortFail.ll
+++ b/llvm/test/Transforms/NewGVN/2009-07-13-MemDepSortFail.ll
@@ -1,67 +1,68 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn | llvm-dis
; PR4256
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
- %llvm.dbg.anchor.type = type { i32, i32 }
- %struct.cset = type { ptr, i8, i8, i32, ptr }
- %struct.lmat = type { ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr }
- %struct.re_guts = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, [1 x i8] }
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %struct.cset = type { ptr, i8, i8, i32, ptr }
+ %struct.lmat = type { ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr }
+ %struct.re_guts = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, [1 x i8] }
define ptr @lbackref(ptr %m, ptr %start, ptr %stop, i32 %startst, i32 %stopst, i32 %lev, i32 %rec) nounwind {
entry:
- br label %bb63
+ br label %bb63
bb: ; preds = %bb63
- switch i32 0, label %bb62 [
- i32 268435456, label %bb2
- i32 805306368, label %bb9
- i32 -1610612736, label %bb51
- ]
+ switch i32 0, label %bb62 [
+ i32 268435456, label %bb2
+ i32 805306368, label %bb9
+ i32 -1610612736, label %bb51
+ ]
bb2: ; preds = %bb
- br label %bb62
+ br label %bb62
bb9: ; preds = %bb
- %0 = load i8, ptr %sp.1, align 1 ; <i8> [#uses=0]
- br label %bb62
+ %0 = load i8, ptr %sp.1, align 1 ; <i8> [#uses=0]
+ br label %bb62
bb51: ; preds = %bb
- %1 = load i8, ptr %sp.1, align 1 ; <i8> [#uses=0]
- ret ptr null
+ %1 = load i8, ptr %sp.1, align 1 ; <i8> [#uses=0]
+ ret ptr null
bb62: ; preds = %bb9, %bb2, %bb
- br label %bb63
+ br label %bb63
bb63: ; preds = %bb84, %bb69, %bb62, %entry
- %sp.1 = phi ptr [ null, %bb62 ], [ %sp.1.lcssa, %bb84 ], [ %start, %entry ], [ %sp.1.lcssa, %bb69 ] ; <ptr> [#uses=3]
- br i1 false, label %bb, label %bb65
+ %sp.1 = phi ptr [ null, %bb62 ], [ %sp.1.lcssa, %bb84 ], [ %start, %entry ], [ %sp.1.lcssa, %bb69 ] ; <ptr> [#uses=3]
+ br i1 false, label %bb, label %bb65
bb65: ; preds = %bb63
- %sp.1.lcssa = phi ptr [ %sp.1, %bb63 ] ; <ptr> [#uses=4]
- br i1 false, label %bb66, label %bb69
+ %sp.1.lcssa = phi ptr [ %sp.1, %bb63 ] ; <ptr> [#uses=4]
+ br i1 false, label %bb66, label %bb69
bb66: ; preds = %bb65
- ret ptr null
+ ret ptr null
bb69: ; preds = %bb65
- switch i32 0, label %bb108.loopexit2.loopexit.loopexit [
- i32 1342177280, label %bb63
- i32 1476395008, label %bb84
- i32 1879048192, label %bb104
- i32 2013265920, label %bb93
- ]
+ switch i32 0, label %bb108.loopexit2.loopexit.loopexit [
+ i32 1342177280, label %bb63
+ i32 1476395008, label %bb84
+ i32 1879048192, label %bb104
+ i32 2013265920, label %bb93
+ ]
bb84: ; preds = %bb69
- %2 = tail call ptr @lbackref(ptr %m, ptr %sp.1.lcssa, ptr %stop, i32 0, i32 %stopst, i32 0, i32 0) nounwind ; <ptr> [#uses=0]
- br label %bb63
+ %2 = tail call ptr @lbackref(ptr %m, ptr %sp.1.lcssa, ptr %stop, i32 0, i32 %stopst, i32 0, i32 0) nounwind ; <ptr> [#uses=0]
+ br label %bb63
bb93: ; preds = %bb69
- ret ptr null
+ ret ptr null
bb104: ; preds = %bb69
- %sp.1.lcssa.lcssa33 = phi ptr [ %sp.1.lcssa, %bb69 ] ; <ptr> [#uses=0]
- unreachable
+ %sp.1.lcssa.lcssa33 = phi ptr [ %sp.1.lcssa, %bb69 ] ; <ptr> [#uses=0]
+ unreachable
bb108.loopexit2.loopexit.loopexit: ; preds = %bb69
- ret ptr null
+ ret ptr null
}
diff --git a/llvm/test/Transforms/NewGVN/2009-11-12-MemDepMallocBitCast.ll b/llvm/test/Transforms/NewGVN/2009-11-12-MemDepMallocBitCast.ll
index 3eda7ca1b812c8..c49f651437cbb5 100644
--- a/llvm/test/Transforms/NewGVN/2009-11-12-MemDepMallocBitCast.ll
+++ b/llvm/test/Transforms/NewGVN/2009-11-12-MemDepMallocBitCast.ll
@@ -1,14 +1,19 @@
-; Test to make sure malloc's bitcast does not block detection of a store
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; Test to make sure malloc's bitcast does not block detection of a store
; to aliased memory; GVN should not optimize away the load in this program.
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
define i64 @test() {
+; CHECK-LABEL: define i64 @test() {
+; CHECK-NEXT: [[TMP1:%.*]] = tail call ptr @malloc(i64 mul (i64 ptrtoint (ptr getelementptr (i64, ptr null, i64 1) to i64), i64 4))
+; CHECK-NEXT: store i8 42, ptr [[TMP1]], align 1
+; CHECK-NEXT: [[Y:%.*]] = load i64, ptr [[TMP1]], align 4
+; CHECK-NEXT: ret i64 [[Y]]
+;
%1 = tail call ptr @malloc(i64 mul (i64 4, i64 ptrtoint (ptr getelementptr (i64, ptr null, i64 1) to i64))) ; <ptr> [#uses=2]
store i8 42, ptr %1
%Y = load i64, ptr %1 ; <i64> [#uses=1]
ret i64 %Y
-; CHECK: %Y = load i64, ptr %1
-; CHECK: ret i64 %Y
}
declare noalias ptr @malloc(i64)
diff --git a/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll b/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
index 321f3cff89a1e0..c6fc7b99cdf8df 100644
--- a/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
+++ b/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll
@@ -1,9 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
; CHECK-NOT: load
; CHECK-NOT: phi
define ptr @cat(ptr %s1, ...) nounwind {
+; CHECK-LABEL: define ptr @cat(
+; CHECK-SAME: ptr [[S1:%.*]], ...) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 undef, label [[BB:%.*]], label [[BB3:%.*]]
+; CHECK: bb:
+; CHECK-NEXT: unreachable
+; CHECK: bb3:
+; CHECK-NEXT: store ptr undef, ptr undef, align 4
+; CHECK-NEXT: br i1 undef, label [[BB5:%.*]], label [[BB6:%.*]]
+; CHECK: bb5:
+; CHECK-NEXT: unreachable
+; CHECK: bb6:
+; CHECK-NEXT: br label [[BB12:%.*]]
+; CHECK: bb8:
+; CHECK-NEXT: br i1 undef, label [[BB9:%.*]], label [[BB10:%.*]]
+; CHECK: bb9:
+; CHECK-NEXT: br label [[BB11:%.*]]
+; CHECK: bb10:
+; CHECK-NEXT: br label [[BB11]]
+; CHECK: bb11:
+; CHECK-NEXT: br label [[BB12]]
+; CHECK: bb12:
+; CHECK-NEXT: br i1 undef, label [[BB8:%.*]], label [[BB13:%.*]]
+; CHECK: bb13:
+; CHECK-NEXT: ret ptr undef
+;
entry:
br i1 undef, label %bb, label %bb3
diff --git a/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll b/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
index 0d2d45a5e0d9ff..0a121ffab761f4 100644
--- a/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
+++ b/llvm/test/Transforms/NewGVN/2010-05-08-OneBit.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn
; PR7052
@@ -12,7 +13,7 @@ entry:
l117.i.i: ; preds = %entry
invoke fastcc void @foo()
- to label %.noexc5 unwind label %landing_pad
+ to label %.noexc5 unwind label %landing_pad
.noexc5: ; preds = %l117.i.i
unreachable
@@ -22,7 +23,7 @@ k121.i.i: ; preds = %entry
l129.i.i: ; preds = %k121.i.i
invoke fastcc void @foo()
- to label %.noexc7 unwind label %landing_pad
+ to label %.noexc7 unwind label %landing_pad
.noexc7: ; preds = %l129.i.i
unreachable
@@ -34,7 +35,7 @@ k133.i.i: ; preds = %k121.i.i
l147.i.i: ; preds = %k133.i.i
invoke fastcc void @foo()
- to label %.noexc10 unwind label %landing_pad
+ to label %.noexc10 unwind label %landing_pad
.noexc10: ; preds = %l147.i.i
unreachable
@@ -44,10 +45,10 @@ k151.i.i: ; preds = %k133.i.i
landing_pad: ; preds = %l147.i.i, %l129.i.i, %l117.i.i
%exn = landingpad {ptr, i32}
- cleanup
+ cleanup
switch i32 undef, label %fin [
- i32 1, label %catch1
- i32 2, label %catch
+ i32 1, label %catch1
+ i32 2, label %catch
]
fin: ; preds = %landing_pad
diff --git a/llvm/test/Transforms/NewGVN/2010-11-13-Simplify.ll b/llvm/test/Transforms/NewGVN/2010-11-13-Simplify.ll
index b06570b0ebf8dd..3d12783ee53cc7 100644
--- a/llvm/test/Transforms/NewGVN/2010-11-13-Simplify.ll
+++ b/llvm/test/Transforms/NewGVN/2010-11-13-Simplify.ll
@@ -1,9 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
declare i32 @foo(i32) readnone
define i1 @bar() {
-; CHECK-LABEL: @bar(
+; CHECK-LABEL: define i1 @bar() {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(i32 0) #[[ATTR0:[0-9]+]]
+; CHECK-NEXT: [[X:%.*]] = call i32 @foo(i32 [[A]]) #[[ATTR0]]
+; CHECK-NEXT: ret i1 true
+;
%a = call i32 @foo (i32 0) readnone
%b = call i32 @foo (i32 0) readnone
%c = and i32 %a, %b
@@ -11,5 +16,4 @@ define i1 @bar() {
%y = call i32 @foo (i32 %c) readnone
%z = icmp eq i32 %x, %y
ret i1 %z
-; CHECK: ret i1 true
-}
+}
diff --git a/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll b/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
index 3e8a5d84405eaf..c039422be84ed1 100644
--- a/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
+++ b/llvm/test/Transforms/NewGVN/2011-04-27-phioperands.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -disable-output < %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64"
@@ -64,10 +65,10 @@ doemit.exit76.i:
"<bb 64>.i":
switch i32 undef, label %"<bb 5>" [
- i32 42, label %"<L54>.i"
- i32 43, label %"<L55>.i"
- i32 63, label %"<L56>.i"
- i32 123, label %"<bb 5>.i258.i"
+ i32 42, label %"<L54>.i"
+ i32 43, label %"<L55>.i"
+ i32 63, label %"<L56>.i"
+ i32 123, label %"<bb 5>.i258.i"
]
"<L54>.i":
@@ -93,14 +94,14 @@ doemit.exit127.i:
"<bb 5>":
switch i32 undef, label %"<L39>.i" [
- i32 36, label %"<L19>.i"
- i32 94, label %"<L18>.i"
- i32 124, label %"<L98>.i"
- i32 42, label %"<L99>.i"
- i32 43, label %"<L99>.i"
- i32 46, label %"<L24>.i"
- i32 63, label %"<L99>.i"
- i32 91, label %"<L28>.i"
- i32 92, label %"<L29>.i"
+ i32 36, label %"<L19>.i"
+ i32 94, label %"<L18>.i"
+ i32 124, label %"<L98>.i"
+ i32 42, label %"<L99>.i"
+ i32 43, label %"<L99>.i"
+ i32 46, label %"<L24>.i"
+ i32 63, label %"<L99>.i"
+ i32 91, label %"<L28>.i"
+ i32 92, label %"<L29>.i"
]
}
diff --git a/llvm/test/Transforms/NewGVN/2011-07-07-MatchIntrinsicExtract.ll b/llvm/test/Transforms/NewGVN/2011-07-07-MatchIntrinsicExtract.ll
index c547e8fac5e583..444385d81ab416 100644
--- a/llvm/test/Transforms/NewGVN/2011-07-07-MatchIntrinsicExtract.ll
+++ b/llvm/test/Transforms/NewGVN/2011-07-07-MatchIntrinsicExtract.ll
@@ -1,9 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
;
%0 = type { i64, i1 }
define i64 @test1(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test1(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[UADD_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[UADD_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%uadd = tail call %0 @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
%uadd.0 = extractvalue %0 %uadd, 0
@@ -12,11 +25,20 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test1(
-; CHECK-NOT: add1
-; CHECK: ret
define i64 @test2(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test2(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[USUB_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[USUB_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%usub = tail call %0 @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
%usub.0 = extractvalue %0 %usub, 0
@@ -25,11 +47,20 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test2(
-; CHECK-NOT: sub1
-; CHECK: ret
define i64 @test3(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test3(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[UMUL_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[UMUL_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%umul = tail call %0 @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
%umul.0 = extractvalue %0 %umul, 0
@@ -38,11 +69,20 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test3(
-; CHECK-NOT: mul1
-; CHECK: ret
define i64 @test4(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test4(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[SADD_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[SADD_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%sadd = tail call %0 @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
%sadd.0 = extractvalue %0 %sadd, 0
@@ -51,11 +91,20 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test4(
-; CHECK-NOT: add1
-; CHECK: ret
define i64 @test5(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test5(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.ssub.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[SSUB_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[SSUB_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%ssub = tail call %0 @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
%ssub.0 = extractvalue %0 %ssub, 0
@@ -64,11 +113,20 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test5(
-; CHECK-NOT: sub1
-; CHECK: ret
define i64 @test6(i64 %a, i64 %b) nounwind ssp {
+; CHECK-LABEL: define i64 @test6(
+; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 [[A]], i64 [[B]])
+; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
+; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
+; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
+; CHECK-NEXT: [[SMUL_0:%.*]] = extractvalue [[TMP0]] [[TMP4]], 0
+; CHECK-NEXT: [[ADD2:%.*]] = add i64 [[TMP1]], [[SMUL_0]]
+; CHECK-NEXT: ret i64 [[ADD2]]
+;
entry:
%smul = tail call %0 @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
%smul.0 = extractvalue %0 %smul, 0
@@ -77,9 +135,6 @@ entry:
ret i64 %add2
}
-; CHECK-LABEL: @test6(
-; CHECK-NOT: mul1
-; CHECK: ret
declare void @exit(i32) noreturn
declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone
diff --git a/llvm/test/Transforms/NewGVN/2011-09-07-TypeIdFor.ll b/llvm/test/Transforms/NewGVN/2011-09-07-TypeIdFor.ll
index 46e3c2830920ce..675e7da26a1059 100644
--- a/llvm/test/Transforms/NewGVN/2011-09-07-TypeIdFor.ll
+++ b/llvm/test/Transforms/NewGVN/2011-09-07-TypeIdFor.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
%struct.__type_info_pseudo = type { ptr, ptr }
@@ -18,26 +19,70 @@ declare void @__cxa_end_catch()
declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr)
define void @_Z3foov() uwtable personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: define void @_Z3foov(
+; CHECK-SAME: ) #[[ATTR2:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: invoke void @_Z4barv()
+; CHECK-NEXT: to label [[RETURN:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: lpad:
+; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @_ZTIi
+; CHECK-NEXT: catch ptr @_ZTIb
+; CHECK-NEXT: catch ptr @_ZTIi
+; CHECK-NEXT: catch ptr @_ZTIb
+; CHECK-NEXT: [[EXC_PTR2_I:%.*]] = extractvalue { ptr, i32 } [[TMP0]], 0
+; CHECK-NEXT: [[FILTER3_I:%.*]] = extractvalue { ptr, i32 } [[TMP0]], 1
+; CHECK-NEXT: [[TYPEID_I:%.*]] = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[FILTER3_I]], [[TYPEID_I]]
+; CHECK-NEXT: br i1 [[TMP1]], label [[PPAD:%.*]], label [[NEXT:%.*]]
+; CHECK: next:
+; CHECK-NEXT: [[TYPEID1_I:%.*]] = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIb)
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[FILTER3_I]], [[TYPEID1_I]]
+; CHECK-NEXT: br i1 [[TMP2]], label [[PPAD2:%.*]], label [[NEXT2:%.*]]
+; CHECK: ppad:
+; CHECK-NEXT: [[TMP3:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR1]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: ppad2:
+; CHECK-NEXT: [[D_2073_5_I:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR1]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: next2:
+; CHECK-NEXT: call void @_Z7cleanupv()
+; CHECK-NEXT: br i1 [[TMP1]], label [[PPAD3:%.*]], label [[NEXT3:%.*]]
+; CHECK: next3:
+; CHECK-NEXT: br i1 [[TMP2]], label [[PPAD4:%.*]], label [[UNWIND:%.*]]
+; CHECK: unwind:
+; CHECK-NEXT: resume { ptr, i32 } [[TMP0]]
+; CHECK: ppad3:
+; CHECK-NEXT: [[TMP4:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR1]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: ppad4:
+; CHECK-NEXT: [[D_2080_5:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR1]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: ret void
+;
entry:
invoke void @_Z4barv()
- to label %return unwind label %lpad
+ to label %return unwind label %lpad
lpad: ; preds = %entry
%0 = landingpad { ptr, i32 }
- catch ptr @_ZTIi
- catch ptr @_ZTIb
- catch ptr @_ZTIi
- catch ptr @_ZTIb
+ catch ptr @_ZTIi
+ catch ptr @_ZTIb
+ catch ptr @_ZTIi
+ catch ptr @_ZTIb
%exc_ptr2.i = extractvalue { ptr, i32 } %0, 0
%filter3.i = extractvalue { ptr, i32 } %0, 1
%typeid.i = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
-; CHECK: call i32 @llvm.eh.typeid.for
%1 = icmp eq i32 %filter3.i, %typeid.i
br i1 %1, label %ppad, label %next
next: ; preds = %lpad
%typeid1.i = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIb)
-; CHECK: call i32 @llvm.eh.typeid.for
%2 = icmp eq i32 %filter3.i, %typeid1.i
br i1 %2, label %ppad2, label %next2
@@ -54,7 +99,6 @@ ppad2: ; preds = %next
next2: ; preds = %next
call void @_Z7cleanupv()
%typeid = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
-; CHECK-NOT: call i32 @llvm.eh.typeid.for
%4 = icmp eq i32 %filter3.i, %typeid
br i1 %4, label %ppad3, label %next3
diff --git a/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll b/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
index 787a3ba70325e6..1357f2b809f748 100644
--- a/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
+++ b/llvm/test/Transforms/NewGVN/2012-05-22-PreCrash.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn
; PR12858
diff --git a/llvm/test/Transforms/NewGVN/2016-08-30-MaskedScatterGather-xfail-inseltpoison.ll b/llvm/test/Transforms/NewGVN/2016-08-30-MaskedScatterGather-xfail-inseltpoison.ll
index 2fb275d7aaf4de..7b3f33bd4dbea7 100644
--- a/llvm/test/Transforms/NewGVN/2016-08-30-MaskedScatterGather-xfail-inseltpoison.ll
+++ b/llvm/test/Transforms/NewGVN/2016-08-30-MaskedScatterGather-xfail-inseltpoison.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; XFAIL: *
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
@@ -14,6 +15,25 @@ declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x
; CHECK: llvm.masked.scatter
; CHECK: llvm.masked.gather
define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {
+; CHECK-LABEL: define spir_kernel void @test(
+; CHECK-SAME: <2 x ptr> [[IN1:%.*]], <2 x ptr> [[IN2:%.*]], ptr [[OUT:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP_0:%.*]] = alloca i32, align 4
+; CHECK-NEXT: [[TMP_1:%.*]] = alloca i32, align 4
+; CHECK-NEXT: [[TMP_I:%.*]] = insertelement <2 x ptr> poison, ptr [[TMP_0]], i32 0
+; CHECK-NEXT: [[TMP:%.*]] = insertelement <2 x ptr> [[TMP_I]], ptr [[TMP_1]], i32 1
+; CHECK-NEXT: [[IN1_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN1]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)
+; CHECK-NEXT: [[IN2_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN2]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)
+; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN1_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>)
+; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN2_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>)
+; CHECK-NEXT: [[TMP_V_1:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)
+; CHECK-NEXT: [[TMP_V_1_0:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 0
+; CHECK-NEXT: [[TMP_V_1_1:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 1
+; CHECK-NEXT: store i32 [[TMP_V_1_0]], ptr [[OUT]], align 4
+; CHECK-NEXT: [[OUT_1:%.*]] = getelementptr i32, ptr [[OUT]], i32 1
+; CHECK-NEXT: store i32 [[TMP_V_1_1]], ptr [[OUT_1]], align 4
+; CHECK-NEXT: ret void
+;
entry:
; Just some temporary storage
%tmp.0 = alloca i32
diff --git a/llvm/test/Transforms/NewGVN/MemdepMiscompile.ll b/llvm/test/Transforms/NewGVN/MemdepMiscompile.ll
index f2d1827d87b0d0..a3f1f4d8182fb3 100644
--- a/llvm/test/Transforms/NewGVN/MemdepMiscompile.ll
+++ b/llvm/test/Transforms/NewGVN/MemdepMiscompile.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-macosx10.7.0"
@@ -7,14 +8,38 @@ target triple = "x86_64-apple-macosx10.7.0"
; Make sure we do not replace load %shouldExit in while.cond.backedge
; with a phi node where the value from while.body is 0.
define i32 @test() nounwind ssp {
+; CHECK-LABEL: define i32 @test(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[SHOULDEXIT:%.*]] = alloca i32, align 4
+; CHECK-NEXT: [[TASKSIDLE:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store i32 0, ptr [[SHOULDEXIT]], align 4
+; CHECK-NEXT: store i32 0, ptr [[TASKSIDLE]], align 4
+; CHECK-NEXT: call void @CTestInitialize(ptr [[TASKSIDLE]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[SHOULDEXIT]], align 4
+; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP0]], 0
+; CHECK-NEXT: br i1 [[CMP1]], label [[WHILE_BODY_LR_PH:%.*]], label [[WHILE_END:%.*]]
+; CHECK: while.body.lr.ph:
+; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
+; CHECK: while.body:
+; CHECK-NEXT: call void @RunInMode(i32 100) #[[ATTR1]]
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TASKSIDLE]], align 4
+; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TOBOOL]], label [[WHILE_COND_BACKEDGE:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i32 0, ptr [[TASKSIDLE]], align 4
+; CHECK-NEXT: call void @TimerCreate(ptr [[SHOULDEXIT]]) #[[ATTR1]]
+; CHECK-NEXT: br label [[WHILE_COND_BACKEDGE]]
+; CHECK: while.cond.backedge:
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[SHOULDEXIT]], align 4
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP2]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY]], label [[WHILE_COND_WHILE_END_CRIT_EDGE:%.*]]
+; CHECK: while.cond.while.end_crit_edge:
+; CHECK-NEXT: br label [[WHILE_END]]
+; CHECK: while.end:
+; CHECK-NEXT: ret i32 0
+;
entry:
-; CHECK: test()
-; CHECK: while.body:
-; CHECK: call void @RunInMode
-; CHECK: br i1 %tobool, label %while.cond.backedge, label %if.then
-; CHECK: while.cond.backedge:
-; CHECK: load i32, ptr %shouldExit
-; CHECK: br i1 %cmp, label %while.body
%shouldExit = alloca i32, align 4
%tasksIdle = alloca i32, align 4
store i32 0, ptr %shouldExit, align 4
diff --git a/llvm/test/Transforms/NewGVN/addrspacecast.ll b/llvm/test/Transforms/NewGVN/addrspacecast.ll
index fea8a2f3f85869..394db28425d98b 100644
--- a/llvm/test/Transforms/NewGVN/addrspacecast.ll
+++ b/llvm/test/Transforms/NewGVN/addrspacecast.ll
@@ -7,7 +7,7 @@ define ptr addrspace(1) @addrspacecast(ptr %ptr) {
; CHECK-NEXT: [[Z1:%.*]] = addrspacecast ptr [[PTR:%.*]] to ptr addrspace(1)
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block2:
-; CHECK-NEXT: store ptr addrspace(1) [[Z1]], ptr undef
+; CHECK-NEXT: store ptr addrspace(1) [[Z1]], ptr undef, align 8
; CHECK-NEXT: ret ptr addrspace(1) [[Z1]]
;
block1:
@@ -29,7 +29,7 @@ define ptr addrspace(1) @addrspacecast_different_result_types(ptr %ptr) {
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block2:
; CHECK-NEXT: [[Z2:%.*]] = addrspacecast ptr [[PTR]] to ptr addrspace(1)
-; CHECK-NEXT: store ptr addrspace(2) [[Z1]], ptr undef
+; CHECK-NEXT: store ptr addrspace(2) [[Z1]], ptr undef, align 8
; CHECK-NEXT: ret ptr addrspace(1) [[Z2]]
;
block1:
@@ -48,7 +48,7 @@ define ptr addrspace(1) @addrspacecast_simplify(ptr addrspace(1) %ptr) {
; CHECK-NEXT: [[CAST0:%.*]] = addrspacecast ptr addrspace(1) [[PTR:%.*]] to ptr
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block2:
-; CHECK-NEXT: store ptr addrspace(1) [[PTR]], ptr undef
+; CHECK-NEXT: store ptr addrspace(1) [[PTR]], ptr undef, align 8
; CHECK-NEXT: ret ptr addrspace(1) [[PTR]]
;
block1:
@@ -70,7 +70,7 @@ define ptr addrspace(1) @addrspacecast_constant() {
; CHECK-NEXT: store ptr undef, ptr @h, align 4
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block2:
-; CHECK-NEXT: store ptr addrspace(1) undef, ptr undef
+; CHECK-NEXT: store ptr addrspace(1) undef, ptr undef, align 8
; CHECK-NEXT: ret ptr addrspace(1) undef
;
block1:
@@ -88,11 +88,11 @@ block2:
define ptr addrspace(1) @addrspacecast_leader(ptr %arg.ptr) {
; CHECK-LABEL: @addrspacecast_leader(
; CHECK-NEXT: block1:
-; CHECK-NEXT: [[LOAD0:%.*]] = load ptr, ptr [[ARG_PTR:%.*]]
+; CHECK-NEXT: [[LOAD0:%.*]] = load ptr, ptr [[ARG_PTR:%.*]], align 8
; CHECK-NEXT: [[Z1:%.*]] = addrspacecast ptr [[LOAD0]] to ptr addrspace(1)
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block2:
-; CHECK-NEXT: store ptr addrspace(1) [[Z1]], ptr undef
+; CHECK-NEXT: store ptr addrspace(1) [[Z1]], ptr undef, align 8
; CHECK-NEXT: ret ptr addrspace(1) [[Z1]]
;
block1:
diff --git a/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll b/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
index baef8b51fbc15e..53190466963a19 100644
--- a/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
+++ b/llvm/test/Transforms/NewGVN/basic-cyclic-opt.ll
@@ -245,7 +245,7 @@ bb23: ; preds = %bb4
define i8 @irreducible_memoryphi(ptr noalias %arg, ptr noalias %arg2) {
; CHECK-LABEL: @irreducible_memoryphi(
; CHECK-NEXT: bb:
-; CHECK-NEXT: store i8 0, ptr [[ARG:%.*]]
+; CHECK-NEXT: store i8 0, ptr [[ARG:%.*]], align 1
; CHECK-NEXT: br i1 undef, label [[BB2:%.*]], label [[BB1:%.*]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB2]]
diff --git a/llvm/test/Transforms/NewGVN/basic-undef-test.ll b/llvm/test/Transforms/NewGVN/basic-undef-test.ll
index 5b731fc5f9fa07..148c0227adf269 100644
--- a/llvm/test/Transforms/NewGVN/basic-undef-test.ll
+++ b/llvm/test/Transforms/NewGVN/basic-undef-test.ll
@@ -1,15 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
; ModuleID = 'test3.ll'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define i32 @main(ptr %foo) {
+; CHECK-LABEL: define i32 @main(
+; CHECK-SAME: ptr [[FOO:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[FOO]], align 4
+; CHECK-NEXT: store i32 5, ptr undef, align 4
+; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], [[TMP0]]
+; CHECK-NEXT: ret i32 [[TMP1]]
+;
entry:
-; CHECK: load i32, ptr %foo, align 4
%0 = load i32, ptr %foo, align 4
store i32 5, ptr undef, align 4
-; CHECK-NOT: load i32, ptr %foo, align 4
%1 = load i32, ptr %foo, align 4
-; CHECK: add i32 %0, %0
%2 = add i32 %0, %1
ret i32 %2
}
diff --git a/llvm/test/Transforms/NewGVN/br-identical.ll b/llvm/test/Transforms/NewGVN/br-identical.ll
index c99838525aa2d7..23f43b01f443b6 100644
--- a/llvm/test/Transforms/NewGVN/br-identical.ll
+++ b/llvm/test/Transforms/NewGVN/br-identical.ll
@@ -1,8 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S -o - %s | FileCheck %s
; If a branch has two identical successors, we cannot declare either dead.
define void @widget(i1 %p) {
+; CHECK-LABEL: define void @widget(
+; CHECK-SAME: i1 [[P:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[BB2:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[T1:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[T2:%.*]], [[BB7:%.*]] ]
+; CHECK-NEXT: [[T2]] = add i64 [[T1]], 1
+; CHECK-NEXT: [[T3:%.*]] = icmp ult i64 0, [[T2]]
+; CHECK-NEXT: br i1 [[T3]], label [[BB3:%.*]], label [[BB4:%.*]]
+; CHECK: bb3:
+; CHECK-NEXT: [[T4:%.*]] = call i64 @f()
+; CHECK-NEXT: br label [[BB4]]
+; CHECK: bb4:
+; CHECK-NEXT: br i1 [[P]], label [[BB5:%.*]], label [[BB6:%.*]]
+; CHECK: bb5:
+; CHECK-NEXT: br i1 true, label [[BB7]], label [[BB7]]
+; CHECK: bb6:
+; CHECK-NEXT: br i1 true, label [[BB7]], label [[BB7]]
+; CHECK: bb7:
+; CHECK-NEXT: br i1 [[P]], label [[BB2]], label [[BB8:%.*]]
+; CHECK: bb8:
+; CHECK-NEXT: ret void
+;
entry:
br label %bb2
@@ -17,7 +41,6 @@ bb3:
br label %bb4
bb4:
- ; CHECK-NOT: phi {{.*}} undef
%foo = phi i64 [ %t4, %bb3 ], [ 0, %bb2 ]
br i1 %p, label %bb5, label %bb6
diff --git a/llvm/test/Transforms/NewGVN/calloc-load-removal.ll b/llvm/test/Transforms/NewGVN/calloc-load-removal.ll
index a8a1e66d97d95f..608f739e175fe3 100644
--- a/llvm/test/Transforms/NewGVN/calloc-load-removal.ll
+++ b/llvm/test/Transforms/NewGVN/calloc-load-removal.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn < %s | FileCheck %s
; Check that loads from calloc are recognized as being zero.
@@ -5,14 +6,15 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Function Attrs: nounwind uwtable
define i32 @test1() {
+; CHECK-LABEL: define i32 @test1() {
+; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias ptr @calloc(i64 1, i64 4)
+; CHECK-NEXT: ret i32 0
+;
%1 = tail call noalias ptr @calloc(i64 1, i64 4)
; This load is trivially constant zero
%2 = load i32, ptr %1, align 4
ret i32 %2
-; CHECK-LABEL: @test1(
-; CHECK-NOT: %2 = load i32, ptr %1, align 4
-; CHECK: ret i32 0
}
declare noalias ptr @calloc(i64, i64) mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc"
diff --git a/llvm/test/Transforms/NewGVN/calls-readonly.ll b/llvm/test/Transforms/NewGVN/calls-readonly.ll
index 68d74c1aeda7fd..49f5d3aa685404 100644
--- a/llvm/test/Transforms/NewGVN/calls-readonly.ll
+++ b/llvm/test/Transforms/NewGVN/calls-readonly.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
; Should delete the second call to strlen even though the intervening strchr call exists.
@@ -5,6 +6,22 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-apple-darwin7"
define ptr @test(ptr %P, ptr %Q, i32 %x, i32 %y) nounwind readonly {
+; CHECK-LABEL: define ptr @test(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]], i32 [[X:%.*]], i32 [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @strlen(ptr [[P]])
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 0
+; CHECK-NEXT: br i1 [[TMP1]], label [[BB:%.*]], label [[BB1:%.*]]
+; CHECK: bb:
+; CHECK-NEXT: [[TMP2:%.*]] = sdiv i32 [[X]], [[Y]]
+; CHECK-NEXT: br label [[BB1]]
+; CHECK: bb1:
+; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi i32 [ [[TMP2]], [[BB]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[TMP3:%.*]] = tail call ptr @strchr(ptr [[Q]], i32 97)
+; CHECK-NEXT: [[TMP4:%.*]] = add i32 [[X_ADDR_0]], [[TMP0]]
+; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[TMP3]], i32 [[X_ADDR_0]]
+; CHECK-NEXT: ret ptr [[TMP5]]
+;
entry:
%0 = tail call i32 @strlen(ptr %P) ; <i32> [#uses=2]
%1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
@@ -24,21 +41,6 @@ bb1: ; preds = %bb, %entry
ret ptr %6
}
-; CHECK: define ptr @test(ptr %P, ptr %Q, i32 %x, i32 %y) #0 {
-; CHECK: entry:
-; CHECK-NEXT: %0 = tail call i32 @strlen(ptr %P)
-; CHECK-NEXT: %1 = icmp eq i32 %0, 0
-; CHECK-NEXT: br i1 %1, label %bb, label %bb1
-; CHECK: bb:
-; CHECK-NEXT: %2 = sdiv i32 %x, %y
-; CHECK-NEXT: br label %bb1
-; CHECK: bb1:
-; CHECK-NEXT: %x_addr.0 = phi i32 [ %2, %bb ], [ %x, %entry ]
-; CHECK-NEXT: %3 = tail call ptr @strchr(ptr %Q, i32 97)
-; CHECK-NEXT: %4 = add i32 %x_addr.0, %0
-; CHECK-NEXT: %5 = getelementptr i8, ptr %3, i32 %x_addr.0
-; CHECK-NEXT: ret ptr %5
-; CHECK: }
declare i32 @strlen(ptr) nounwind readonly
diff --git a/llvm/test/Transforms/NewGVN/completeness.ll b/llvm/test/Transforms/NewGVN/completeness.ll
index d968c785ceff0f..4841e2e958b281 100644
--- a/llvm/test/Transforms/NewGVN/completeness.ll
+++ b/llvm/test/Transforms/NewGVN/completeness.ll
@@ -6,9 +6,12 @@ define i32 @test1(i32, ptr) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP0:%.*]], 0
; CHECK-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]]
-; CHECK: br label [[TMP6:%.*]]
-; CHECK: br label [[TMP6]]
-; CHECK: [[PHIOFOPS:%.*]] = phi i32 [ 105, [[TMP5]] ], [ 75, [[TMP4]] ]
+; CHECK: 4:
+; CHECK-NEXT: br label [[TMP6:%.*]]
+; CHECK: 5:
+; CHECK-NEXT: br label [[TMP6]]
+; CHECK: 6:
+; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i32 [ 105, [[TMP5]] ], [ 75, [[TMP4]] ]
; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 5, [[TMP4]] ], [ 7, [[TMP5]] ]
; CHECK-NEXT: ret i32 [[PHIOFOPS]]
;
@@ -31,9 +34,12 @@ define i32 @test1b(i32, ptr) {
; CHECK-LABEL: @test1b(
; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP0:%.*]], 0
; CHECK-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]]
-; CHECK: br label [[TMP6:%.*]]
-; CHECK: br label [[TMP6]]
-; CHECK: [[PHIOFOPS1:%.*]] = phi i32 [ 105, [[TMP5]] ], [ 75, [[TMP4]] ]
+; CHECK: 4:
+; CHECK-NEXT: br label [[TMP6:%.*]]
+; CHECK: 5:
+; CHECK-NEXT: br label [[TMP6]]
+; CHECK: 6:
+; CHECK-NEXT: [[PHIOFOPS1:%.*]] = phi i32 [ 105, [[TMP5]] ], [ 75, [[TMP4]] ]
; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i32 [ 1575, [[TMP5]] ], [ 1125, [[TMP4]] ]
; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 5, [[TMP4]] ], [ 7, [[TMP5]] ]
; CHECK-NEXT: ret i32 [[PHIOFOPS]]
@@ -58,9 +64,12 @@ define i32 @test2(i32) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP0:%.*]], 0
; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
-; CHECK: br label [[TMP5:%.*]]
-; CHECK: br label [[TMP5]]
-; CHECK: [[DOT01:%.*]] = phi i32 [ 3, [[TMP3]] ], [ 2, [[TMP4]] ]
+; CHECK: 3:
+; CHECK-NEXT: br label [[TMP5:%.*]]
+; CHECK: 4:
+; CHECK-NEXT: br label [[TMP5]]
+; CHECK: 5:
+; CHECK-NEXT: [[DOT01:%.*]] = phi i32 [ 3, [[TMP3]] ], [ 2, [[TMP4]] ]
; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 2, [[TMP3]] ], [ 3, [[TMP4]] ]
; CHECK-NEXT: ret i32 5
;
@@ -158,9 +167,12 @@ define i32 @test4(i32, ptr, ptr noalias, ptr noalias) {
; CHECK-NEXT: store i32 7, ptr [[TMP3:%.*]], align 4
; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP0:%.*]], 0
; CHECK-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]]
-; CHECK: br label [[TMP8:%.*]]
-; CHECK: br label [[TMP8]]
-; CHECK: [[DOT01:%.*]] = phi i32 [ 5, [[TMP6]] ], [ 7, [[TMP7]] ]
+; CHECK: 6:
+; CHECK-NEXT: br label [[TMP8:%.*]]
+; CHECK: 7:
+; CHECK-NEXT: br label [[TMP8]]
+; CHECK: 8:
+; CHECK-NEXT: [[DOT01:%.*]] = phi i32 [ 5, [[TMP6]] ], [ 7, [[TMP7]] ]
; CHECK-NEXT: [[DOT0:%.*]] = phi ptr [ [[TMP2]], [[TMP6]] ], [ [[TMP3]], [[TMP7]] ]
; CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOT0]], align 4
; CHECK-NEXT: [[TMP10:%.*]] = mul nsw i32 [[TMP9]], 15
@@ -287,19 +299,19 @@ bb28: ; preds = %bb27, %bb
define i8 @test6(ptr %addr) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: entry-block:
-; CHECK-NEXT: br label %main-loop
+; CHECK-NEXT: br label [[MAIN_LOOP:%.*]]
; CHECK: main-loop:
-; CHECK-NEXT: [[PHIOFOPS1:%.*]] = phi i1 [ true, %entry-block ], [ false, [[CORE:%.*]] ]
-; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i1 [ false, %entry-block ], [ true, [[CORE]] ]
-; CHECK-NEXT: [[PHI:%.*]] = phi i8 [ 0, %entry-block ], [ 1, [[CORE]] ]
-; CHECK-NEXT: store volatile i8 0, ptr [[ADDR:%.*]]
-; CHECK-NEXT: br i1 [[PHIOFOPS1]], label %busy-wait-phi-0, label [[EXIT:%.*]]
+; CHECK-NEXT: [[PHIOFOPS1:%.*]] = phi i1 [ true, [[ENTRY_BLOCK:%.*]] ], [ false, [[CORE:%.*]] ]
+; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i1 [ false, [[ENTRY_BLOCK]] ], [ true, [[CORE]] ]
+; CHECK-NEXT: [[PHI:%.*]] = phi i8 [ 0, [[ENTRY_BLOCK]] ], [ 1, [[CORE]] ]
+; CHECK-NEXT: store volatile i8 0, ptr [[ADDR:%.*]], align 1
+; CHECK-NEXT: br i1 [[PHIOFOPS1]], label [[BUSY_WAIT_PHI_0:%.*]], label [[EXIT:%.*]]
; CHECK: busy-wait-phi-0:
-; CHECK-NEXT: [[LOAD:%.*]] = load volatile i8, ptr [[ADDR]]
+; CHECK-NEXT: [[LOAD:%.*]] = load volatile i8, ptr [[ADDR]], align 1
; CHECK-NEXT: [[ICMP:%.*]] = icmp eq i8 [[LOAD]], 0
-; CHECK-NEXT: br i1 [[ICMP]], label %busy-wait-phi-0, label [[CORE]]
+; CHECK-NEXT: br i1 [[ICMP]], label [[BUSY_WAIT_PHI_0]], label [[CORE]]
; CHECK: core:
-; CHECK-NEXT: br i1 [[PHIOFOPS]], label [[TRAP:%.*]], label %main-loop
+; CHECK-NEXT: br i1 [[PHIOFOPS]], label [[TRAP:%.*]], label [[MAIN_LOOP]]
; CHECK: trap:
; CHECK-NEXT: ret i8 1
; CHECK: exit:
@@ -507,13 +519,13 @@ declare ptr @wombat()
define void @test12(ptr %p) {
; CHECK-LABEL: @test12(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr %p
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[P:%.*]], align 4
; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[TMP]], 0
; CHECK-NEXT: br i1 [[TMP1]], label [[BB2:%.*]], label [[BB8:%.*]]
; CHECK: bb2:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: br i1 true, label [[BB6:%.*]], label [[BB7]]
+; CHECK-NEXT: br i1 true, label [[BB6:%.*]], label [[BB7:%.*]]
; CHECK: bb6:
; CHECK-NEXT: br label [[BB7]]
; CHECK: bb7:
@@ -551,7 +563,7 @@ define void @test13() {
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[TMP:%.*]] = load i8, ptr null
+; CHECK-NEXT: [[TMP:%.*]] = load i8, ptr null, align 1
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i8 [ [[TMP]], [[BB1]] ], [ [[TMP10:%.*]], [[BB3]] ]
@@ -560,7 +572,7 @@ define void @test13() {
; CHECK-NEXT: [[TMP6]] = getelementptr i8, ptr [[TMP4]], i64 1
; CHECK-NEXT: [[TMP8:%.*]] = sext i8 [[PHIOFOPS]] to i32
; CHECK-NEXT: [[TMP9]] = mul i32 [[TMP5]], [[TMP8]]
-; CHECK-NEXT: [[TMP10]] = load i8, ptr [[TMP6]]
+; CHECK-NEXT: [[TMP10]] = load i8, ptr [[TMP6]], align 1
; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i8 [[TMP10]], 0
; CHECK-NEXT: br i1 [[TMP11]], label [[BB12:%.*]], label [[BB3]]
; CHECK: bb12:
diff --git a/llvm/test/Transforms/NewGVN/cond_br.ll b/llvm/test/Transforms/NewGVN/cond_br.ll
index 3dbeb394c7cfa7..930e5b30c08884 100644
--- a/llvm/test/Transforms/NewGVN/cond_br.ll
+++ b/llvm/test/Transforms/NewGVN/cond_br.ll
@@ -1,12 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
@y = external global i32
@z = external global i32
; Function Attrs: nounwind ssp uwtable
define void @foo(i32 %x) {
-; CHECK: @foo(i32 %x)
-; CHECK: %.pre = load i32, ptr @y
-; CHECK: call void @bar(i32 %.pre)
+; CHECK-LABEL: define void @foo(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: [[DOTPRE:%.*]] = load i32, ptr @y, align 4
+; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[ENTRY_IF_END_CRIT_EDGE:%.*]]
+; CHECK: entry.if.end_crit_edge:
+; CHECK-NEXT: br label [[IF_END:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: tail call void @bar(i32 [[DOTPRE]])
+; CHECK-NEXT: ret void
+;
%t = sub i32 %x, %x
%.pre = load i32, ptr @y, align 4
@@ -28,9 +39,21 @@ if.end: ; preds = %entry.if.end_crit_e
}
define void @foo2(i32 %x) {
-; CHECK: @foo2(i32 %x)
-; CHECK: %.pre = load i32, ptr @y
-; CHECK: tail call void @bar(i32 %.pre)
+; CHECK-LABEL: define void @foo2(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DOTPRE:%.*]] = load i32, ptr @y, align 4
+; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[IF_END:%.*]]
+; CHECK: if.else:
+; CHECK-NEXT: store i32 1, ptr @z, align 4
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: tail call void @bar(i32 [[DOTPRE]])
+; CHECK-NEXT: ret void
+;
entry:
%t = sub i32 %x, %x
%.pre = load i32, ptr @y, align 4
diff --git a/llvm/test/Transforms/NewGVN/condprop.ll b/llvm/test/Transforms/NewGVN/condprop.ll
index e685dfedab1095..d97fd380c730b2 100644
--- a/llvm/test/Transforms/NewGVN/condprop.ll
+++ b/llvm/test/Transforms/NewGVN/condprop.ll
@@ -134,11 +134,11 @@ define void @test4(i1 %b, i32 %x) {
; CHECK-NEXT: br i1 [[B:%.*]], label [[SW:%.*]], label [[CASE3:%.*]]
; CHECK: sw:
; CHECK-NEXT: switch i32 [[X:%.*]], label [[DEFAULT:%.*]] [
-; CHECK-NEXT: i32 0, label [[CASE0:%.*]]
-; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
-; CHECK-NEXT: i32 2, label [[CASE0]]
-; CHECK-NEXT: i32 3, label [[CASE3]]
-; CHECK-NEXT: i32 4, label [[DEFAULT]]
+; CHECK-NEXT: i32 0, label [[CASE0:%.*]]
+; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
+; CHECK-NEXT: i32 2, label [[CASE0]]
+; CHECK-NEXT: i32 3, label [[CASE3]]
+; CHECK-NEXT: i32 4, label [[DEFAULT]]
; CHECK-NEXT: ]
; CHECK: default:
; CHECK-NEXT: call void @bar(i32 [[X]])
diff --git a/llvm/test/Transforms/NewGVN/crash-no-aa.ll b/llvm/test/Transforms/NewGVN/crash-no-aa.ll
index 55e2bcb00fb758..30f2e379a37603 100644
--- a/llvm/test/Transforms/NewGVN/crash-no-aa.ll
+++ b/llvm/test/Transforms/NewGVN/crash-no-aa.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -disable-basic-aa -passes=newgvn -S < %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/llvm/test/Transforms/NewGVN/crash-usecounts.ll b/llvm/test/Transforms/NewGVN/crash-usecounts.ll
index 5527beabbf3421..5cae740fd484c8 100644
--- a/llvm/test/Transforms/NewGVN/crash-usecounts.ll
+++ b/llvm/test/Transforms/NewGVN/crash-usecounts.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -disable-output < %s
define void @test(i1 %arg, i1 %arg1) {
diff --git a/llvm/test/Transforms/NewGVN/crash.ll b/llvm/test/Transforms/NewGVN/crash.ll
index c886bd384eee2f..26eaa766a05434 100644
--- a/llvm/test/Transforms/NewGVN/crash.ll
+++ b/llvm/test/Transforms/NewGVN/crash.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -disable-output < %s
; PR5631
@@ -106,7 +107,7 @@ if.then21.i:
ret ptr undef
do.body36.i:
- %ivar38.i = load i64, ptr @g
+ %ivar38.i = load i64, ptr @g
%add.ptr39.sum.i = add i64 %ivar38.i, 8
%tmp40.i = getelementptr inbounds i8, ptr %tmp18.i, i64 %add.ptr39.sum.i
%tmp41.i = load i64, ptr %tmp40.i
@@ -132,14 +133,14 @@ declare i32 @foo2()
define i32 @test4() {
entry:
ret i32 0
-
+
dead:
%P2 = getelementptr i32, ptr %P2, i32 52
%Q2 = getelementptr i32, ptr %Q2, i32 52
store i32 4, ptr %P2
%A = load i32, ptr %Q2
br i1 true, label %dead, label %dead2
-
+
dead2:
ret i32 %A
}
diff --git a/llvm/test/Transforms/NewGVN/cyclic-phi-handling.ll b/llvm/test/Transforms/NewGVN/cyclic-phi-handling.ll
index 4a2f0b972c9fe1..dc150799c849c6 100644
--- a/llvm/test/Transforms/NewGVN/cyclic-phi-handling.ll
+++ b/llvm/test/Transforms/NewGVN/cyclic-phi-handling.ll
@@ -5,15 +5,15 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define void @foo(i32 %arg, i32 %arg1, ptr %arg2) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: bb:
-; CHECK-NEXT: br label %bb3
+; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ %arg1, %bb ], [ [[TMP:%.*]]4, %bb7 ]
-; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ %arg, %bb ], [ [[TMP]], %bb7 ]
-; CHECK-NEXT: [[TMP5:%.*]] = call i32 %arg2(i32 [[TMP4]], i32 [[TMP]])
+; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ [[ARG1:%.*]], [[BB:%.*]] ], [ [[TMP4:%.*]], [[BB7:%.*]] ]
+; CHECK-NEXT: [[TMP4]] = phi i32 [ [[ARG:%.*]], [[BB]] ], [ [[TMP]], [[BB7]] ]
+; CHECK-NEXT: [[TMP5:%.*]] = call i32 [[ARG2:%.*]](i32 [[TMP4]], i32 [[TMP]])
; CHECK-NEXT: [[TMP6:%.*]] = icmp ne i32 [[TMP5]], 0
-; CHECK-NEXT: br i1 [[TMP6]], label %bb7, label %bb8
+; CHECK-NEXT: br i1 [[TMP6]], label [[BB7]], label [[BB8:%.*]]
; CHECK: bb7:
-; CHECK-NEXT: br label %bb3
+; CHECK-NEXT: br label [[BB3]]
; CHECK: bb8:
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Transforms/NewGVN/dbg-redundant-load.ll b/llvm/test/Transforms/NewGVN/dbg-redundant-load.ll
index 01d95aebdf2d41..cd2eca0de6d140 100644
--- a/llvm/test/Transforms/NewGVN/dbg-redundant-load.ll
+++ b/llvm/test/Transforms/NewGVN/dbg-redundant-load.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
; Check that the redundant load from %if.then is removed.
@@ -6,15 +7,22 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-; CHECK: @test_redundant_load(
-; CHECK-LABEL: entry:
-; CHECK-NEXT: load i32, ptr %Y, align 4, !dbg ![[LOC:[0-9]+]]
-; CHECK-LABEL: if.then:
-; CHECK-NOT: load
-; CHECK-LABEL: if.end:
-; CHECK: ![[LOC]] = !DILocation(line: 3, scope: !{{.*}})
define i32 @test_redundant_load(i32 %X, ptr %Y) !dbg !6 {
+; CHECK-LABEL: define i32 @test_redundant_load(
+; CHECK-SAME: i32 [[X:%.*]], ptr [[Y:%.*]]) !dbg [[DBG6:![0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[Y]], align 4, !dbg [[DBG8:![0-9]+]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[X]], -1, !dbg [[DBG9:![0-9]+]]
+; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]], !dbg [[DBG9]]
+; CHECK: if.then:
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP0]], !dbg [[DBG10:![0-9]+]]
+; CHECK-NEXT: call void @foo(), !dbg [[DBG11:![0-9]+]]
+; CHECK-NEXT: br label [[IF_END]], !dbg [[DBG12:![0-9]+]]
+; CHECK: if.end:
+; CHECK-NEXT: [[RESULT_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ [[TMP0]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret i32 [[RESULT_0]], !dbg [[DBG13:![0-9]+]]
+;
entry:
%0 = load i32, ptr %Y, align 4, !dbg !8
%cmp = icmp sgt i32 %X, -1, !dbg !9
@@ -50,3 +58,16 @@ declare void @foo()
!11 = !DILocation(line: 7, scope: !6)
!12 = !DILocation(line: 8, scope: !6)
!13 = !DILocation(line: 10, scope: !6)
+;.
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: [[META2:![0-9]+]])
+; CHECK: [[META1]] = !DIFile(filename: "test.cpp", directory: "")
+; CHECK: [[META2]] = !{}
+; CHECK: [[DBG6]] = distinct !DISubprogram(name: "test_redundant_load", scope: [[META1]], file: [[META1]], line: 2, type: [[META7:![0-9]+]], scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META2]])
+; CHECK: [[META7]] = !DISubroutineType(types: [[META2]])
+; CHECK: [[DBG8]] = !DILocation(line: 3, scope: [[DBG6]])
+; CHECK: [[DBG9]] = !DILocation(line: 5, scope: [[DBG6]])
+; CHECK: [[DBG10]] = !DILocation(line: 6, scope: [[DBG6]])
+; CHECK: [[DBG11]] = !DILocation(line: 7, scope: [[DBG6]])
+; CHECK: [[DBG12]] = !DILocation(line: 8, scope: [[DBG6]])
+; CHECK: [[DBG13]] = !DILocation(line: 10, scope: [[DBG6]])
+;.
diff --git a/llvm/test/Transforms/NewGVN/edge.ll b/llvm/test/Transforms/NewGVN/edge.ll
index 8699c85c9ed737..143e52cd139c5a 100644
--- a/llvm/test/Transforms/NewGVN/edge.ll
+++ b/llvm/test/Transforms/NewGVN/edge.ll
@@ -1,7 +1,17 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
define i32 @f1(i32 %x) {
- ; CHECK-LABEL: define i32 @f1(
+; CHECK-LABEL: define i32 @f1(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: bb0:
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[BB2:%.*]], label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB2]]
+; CHECK: bb2:
+; CHECK-NEXT: ret i32 [[X]]
+;
bb0:
%cmp = icmp eq i32 %x, 0
br i1 %cmp, label %bb2, label %bb1
@@ -11,12 +21,19 @@ bb2:
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
%foo = add i32 %cond, %x
ret i32 %foo
- ; CHECK: bb2:
- ; CHECK: ret i32 %x
}
define i32 @f2(i32 %x) {
- ; CHECK-LABEL: define i32 @f2(
+; CHECK-LABEL: define i32 @f2(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: bb0:
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[X]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB2]]
+; CHECK: bb2:
+; CHECK-NEXT: ret i32 [[X]]
+;
bb0:
%cmp = icmp ne i32 %x, 0
br i1 %cmp, label %bb1, label %bb2
@@ -26,12 +43,20 @@ bb2:
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
%foo = add i32 %cond, %x
ret i32 %foo
- ; CHECK: bb2:
- ; CHECK: ret i32 %x
}
define i32 @f3(i32 %x) {
- ; CHECK-LABEL: define i32 @f3(
+; CHECK-LABEL: define i32 @f3(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: bb0:
+; CHECK-NEXT: switch i32 [[X]], label [[BB1:%.*]] [
+; CHECK-NEXT: i32 0, label [[BB2:%.*]]
+; CHECK-NEXT: ]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB2]]
+; CHECK: bb2:
+; CHECK-NEXT: ret i32 [[X]]
+;
bb0:
switch i32 %x, label %bb1 [ i32 0, label %bb2]
bb1:
@@ -40,13 +65,21 @@ bb2:
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
%foo = add i32 %cond, %x
ret i32 %foo
- ; CHECK: bb2:
- ; CHECK: ret i32 %x
}
declare void @g(i1)
define void @f4(ptr %x) {
; CHECK-LABEL: define void @f4(
+; CHECK-SAME: ptr [[X:%.*]]) {
+; CHECK-NEXT: bb0:
+; CHECK-NEXT: [[Y:%.*]] = icmp eq ptr null, [[X]]
+; CHECK-NEXT: br i1 [[Y]], label [[BB2:%.*]], label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB2]]
+; CHECK: bb2:
+; CHECK-NEXT: call void @g(i1 [[Y]])
+; CHECK-NEXT: ret void
+;
bb0:
%y = icmp eq ptr null, %x
br i1 %y, label %bb2, label %bb1
@@ -55,11 +88,22 @@ bb1:
bb2:
%zed = icmp eq ptr null, %x
call void @g(i1 %zed)
-; CHECK: call void @g(i1 %y)
ret void
}
define double @fcmp_oeq_not_zero(double %x, double %y) {
+; CHECK-LABEL: define double @fcmp_oeq_not_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq double [[Y]], 2.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[RETURN:%.*]]
+; CHECK: if:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], 2.000000e+00
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[IF]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
%cmp = fcmp oeq double %y, 2.0
br i1 %cmp, label %if, label %return
@@ -72,11 +116,21 @@ return:
%retval = phi double [ %div, %if ], [ %x, %entry ]
ret double %retval
-; CHECK-LABEL: define double @fcmp_oeq_not_zero(
-; CHECK: %div = fdiv double %x, 2.0
}
define double @fcmp_une_not_zero(double %x, double %y) {
+; CHECK-LABEL: define double @fcmp_une_not_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp une double [[Y]], 2.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[ELSE:%.*]]
+; CHECK: else:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], 2.000000e+00
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[ELSE]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
%cmp = fcmp une double %y, 2.0
br i1 %cmp, label %return, label %else
@@ -89,14 +143,24 @@ return:
%retval = phi double [ %div, %else ], [ %x, %entry ]
ret double %retval
-; CHECK-LABEL: define double @fcmp_une_not_zero(
-; CHECK: %div = fdiv double %x, 2.0
}
-; PR22376 - We can't propagate zero constants because -0.0
+; PR22376 - We can't propagate zero constants because -0.0
; compares equal to 0.0. If %y is -0.0 in this test case,
; we would produce the wrong sign on the infinity return value.
define double @fcmp_oeq_zero(double %x, double %y) {
+; CHECK-LABEL: define double @fcmp_oeq_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq double [[Y]], 0.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[RETURN:%.*]]
+; CHECK: if:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], [[Y]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[IF]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
%cmp = fcmp oeq double %y, 0.0
br i1 %cmp, label %if, label %return
@@ -109,11 +173,21 @@ return:
%retval = phi double [ %div, %if ], [ %x, %entry ]
ret double %retval
-; CHECK-LABEL: define double @fcmp_oeq_zero(
-; CHECK: %div = fdiv double %x, %y
}
define double @fcmp_une_zero(double %x, double %y) {
+; CHECK-LABEL: define double @fcmp_une_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp une double [[Y]], -0.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[ELSE:%.*]]
+; CHECK: else:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], [[Y]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[ELSE]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
%cmp = fcmp une double %y, -0.0
br i1 %cmp, label %return, label %else
@@ -126,45 +200,65 @@ return:
%retval = phi double [ %div, %else ], [ %x, %entry ]
ret double %retval
-; CHECK-LABEL: define double @fcmp_une_zero(
-; CHECK: %div = fdiv double %x, %y
}
; We also cannot propagate a value if it's not a constant.
; This is because the value could be 0.0 or -0.0.
define double @fcmp_oeq_maybe_zero(double %x, double %y, double %z1, double %z2) {
+; CHECK-LABEL: define double @fcmp_oeq_maybe_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], double [[Z1:%.*]], double [[Z2:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[Z:%.*]] = fadd double [[Z1]], [[Z2]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq double [[Y]], [[Z]]
+; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[RETURN:%.*]]
+; CHECK: if:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], [[Z]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[IF]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
- %z = fadd double %z1, %z2
- %cmp = fcmp oeq double %y, %z
- br i1 %cmp, label %if, label %return
+ %z = fadd double %z1, %z2
+ %cmp = fcmp oeq double %y, %z
+ br i1 %cmp, label %if, label %return
if:
- %div = fdiv double %x, %z
- br label %return
+ %div = fdiv double %x, %z
+ br label %return
return:
- %retval = phi double [ %div, %if ], [ %x, %entry ]
- ret double %retval
+ %retval = phi double [ %div, %if ], [ %x, %entry ]
+ ret double %retval
-; CHECK-LABEL: define double @fcmp_oeq_maybe_zero(
-; CHECK: %div = fdiv double %x, %z
}
define double @fcmp_une_maybe_zero(double %x, double %y, double %z1, double %z2) {
+; CHECK-LABEL: define double @fcmp_une_maybe_zero(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]], double [[Z1:%.*]], double [[Z2:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[Z:%.*]] = fadd double [[Z1]], [[Z2]]
+; CHECK-NEXT: [[CMP:%.*]] = fcmp une double [[Y]], [[Z]]
+; CHECK-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[ELSE:%.*]]
+; CHECK: else:
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[X]], [[Z]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[RETVAL:%.*]] = phi double [ [[DIV]], [[ELSE]] ], [ [[X]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[RETVAL]]
+;
entry:
- %z = fadd double %z1, %z2
- %cmp = fcmp une double %y, %z
- br i1 %cmp, label %return, label %else
+ %z = fadd double %z1, %z2
+ %cmp = fcmp une double %y, %z
+ br i1 %cmp, label %return, label %else
else:
- %div = fdiv double %x, %z
- br label %return
+ %div = fdiv double %x, %z
+ br label %return
return:
- %retval = phi double [ %div, %else ], [ %x, %entry ]
- ret double %retval
+ %retval = phi double [ %div, %else ], [ %x, %entry ]
+ ret double %retval
-; CHECK-LABEL: define double @fcmp_une_maybe_zero(
-; CHECK: %div = fdiv double %x, %z
}
diff --git a/llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll b/llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll
index 748485c03c18ab..6cf543840cfe91 100644
--- a/llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll
+++ b/llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll
@@ -1,15 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=inline,newgvn -S < %s | FileCheck %s
-; CHECK-LABEL: @f2()
-; CHECK-NEXT: ret void
define void @f2() {
+; CHECK-LABEL: define void @f2() {
+; CHECK-NEXT: ret void
+;
call void @f1()
call void @f1()
ret void
}
define internal void @f1() #1 {
+; CHECK-LABEL: define internal void @f1(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+;
entry:
ret void
}
diff --git a/llvm/test/Transforms/NewGVN/equivalent-phi.ll b/llvm/test/Transforms/NewGVN/equivalent-phi.ll
index 925795d49af17c..ba4fc14fa2feb4 100644
--- a/llvm/test/Transforms/NewGVN/equivalent-phi.ll
+++ b/llvm/test/Transforms/NewGVN/equivalent-phi.ll
@@ -11,22 +11,22 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define i32 @bar(i32 %arg, i32 %arg1, i32 %arg2) #0 {
; CHECK-LABEL: @bar(
; CHECK-NEXT: bb:
-; CHECK-NEXT: br label %bb3
+; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ %arg, %bb ], [ [[TMP:%.*]]15, %bb17 ]
-; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ %arg2, %bb ], [ [[TMP18:%.*]], %bb17 ]
-; CHECK-NEXT: [[TMP6:%.*]] = phi i32 [ 0, %bb ], [ [[TMP14:%.*]], %bb17 ]
+; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ [[ARG:%.*]], [[BB:%.*]] ], [ [[TMP15:%.*]], [[BB17:%.*]] ]
+; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ [[ARG2:%.*]], [[BB]] ], [ [[TMP18:%.*]], [[BB17]] ]
+; CHECK-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[BB]] ], [ [[TMP14:%.*]], [[BB17]] ]
; CHECK-NEXT: [[TMP7:%.*]] = sext i32 [[TMP]] to i64
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [1024 x i32], ptr @global, i64 0, i64 [[TMP7]]
; CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP8]], align 4
; CHECK-NEXT: [[TMP10:%.*]] = add nsw i32 [[TMP6]], [[TMP9]]
; CHECK-NEXT: [[TMP14]] = add nsw i32 [[TMP10]], [[TMP9]]
-; CHECK-NEXT: [[TMP15:%.*]] = add nsw i32 [[TMP]], %arg1
-; CHECK-NEXT: br label %bb17
+; CHECK-NEXT: [[TMP15]] = add nsw i32 [[TMP]], [[ARG1:%.*]]
+; CHECK-NEXT: br label [[BB17]]
; CHECK: bb17:
; CHECK-NEXT: [[TMP18]] = add i32 [[TMP4]], -1
; CHECK-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP4]], 0
-; CHECK-NEXT: br i1 [[TMP19]], label %bb3, label %bb20
+; CHECK-NEXT: br i1 [[TMP19]], label [[BB3]], label [[BB20:%.*]]
; CHECK: bb20:
; CHECK-NEXT: ret i32 [[TMP14]]
;
diff --git a/llvm/test/Transforms/NewGVN/fold-const-expr.ll b/llvm/test/Transforms/NewGVN/fold-const-expr.ll
index 2821791469494a..54020b88d65a80 100644
--- a/llvm/test/Transforms/NewGVN/fold-const-expr.ll
+++ b/llvm/test/Transforms/NewGVN/fold-const-expr.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; GVN failed to do constant expression folding and expanded
; them unfolded in many places, producing exponentially large const
; expressions. As a result, the compilation never fisished.
@@ -6,6 +7,16 @@
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
%2 = type { i32, i32, i32, i32, i32 }
define i32 @_Z16vector3util_mainv(i32 %x, i32 %y) {
+; CHECK-LABEL: define i32 @_Z16vector3util_mainv(
+; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = alloca [[TMP0:%.*]], align 4
+; CHECK-NEXT: [[TMP114:%.*]] = getelementptr inbounds [[TMP0]], ptr [[TMP1]], i64 0, i32 1
+; CHECK-NEXT: store <4 x i32> <i32 234567891, i32 345678912, i32 456789123, i32 0>, ptr [[TMP114]], align 4
+; CHECK-NEXT: store i32 310393545, ptr [[TMP114]], align 4
+; CHECK-NEXT: store i32 -383584258, ptr [[TMP114]], align 4
+; CHECK-NEXT: store i32 -57163022, ptr [[TMP114]], align 4
+; CHECK-NEXT: ret i32 0
+;
%tmp1 = alloca %2, align 4
%tmp114 = getelementptr inbounds %2, ptr %tmp1, i64 0, i32 1
store <4 x i32> <i32 234567891, i32 345678912, i32 456789123, i32 0>, ptr %tmp114, align 4
@@ -36,7 +47,6 @@ define i32 @_Z16vector3util_mainv(i32 %x, i32 %y) {
%tmp1739 = shl i32 %tmp1738, 22
%tmp1740 = xor i32 %tmp1739, %tmp1738
store i32 %tmp1740, ptr %tmp1683, align 4
-; CHECK: store i32 310393545, ptr %tmp114, align 4
%tmp1756 = getelementptr inbounds %2, ptr %tmp1, i64 0, i32 1
%tmp1761 = load i32, ptr %tmp1756, align 4
%tmp1766 = shl i32 %tmp1761, 5
@@ -64,7 +74,6 @@ define i32 @_Z16vector3util_mainv(i32 %x, i32 %y) {
%tmp1812 = shl i32 %tmp1811, 22
%tmp1813 = xor i32 %tmp1812, %tmp1811
store i32 %tmp1813, ptr %tmp1756, align 4
-; CHECK: store i32 -383584258, ptr %tmp114, align 4
%tmp2645 = getelementptr inbounds %2, ptr %tmp1, i64 0, i32 1
%tmp2650 = load i32, ptr %tmp2645, align 4
%tmp2655 = shl i32 %tmp2650, 5
@@ -92,6 +101,5 @@ define i32 @_Z16vector3util_mainv(i32 %x, i32 %y) {
%tmp2701 = shl i32 %tmp2700, 22
%tmp2702 = xor i32 %tmp2701, %tmp2700
store i32 %tmp2702, ptr %tmp2645, align 4
-; CHECK: store i32 -57163022, ptr %tmp114, align 4
ret i32 0
}
diff --git a/llvm/test/Transforms/NewGVN/fpmath.ll b/llvm/test/Transforms/NewGVN/fpmath.ll
index e8cec8af3e0212..d936c01bbe7887 100644
--- a/llvm/test/Transforms/NewGVN/fpmath.ll
+++ b/llvm/test/Transforms/NewGVN/fpmath.ll
@@ -1,10 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
define double @test1(double %x, double %y) {
-; CHECK: @test1(double %x, double %y)
-; CHECK: %add1 = fadd double %x, %y
-; CHECK-NOT: fpmath
-; CHECK: %foo = fadd double %add1, %add1
+; CHECK-LABEL: define double @test1(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: [[ADD1:%.*]] = fadd double [[X]], [[Y]]
+; CHECK-NEXT: [[FOO:%.*]] = fadd double [[ADD1]], [[ADD1]]
+; CHECK-NEXT: ret double [[FOO]]
+;
%add1 = fadd double %x, %y, !fpmath !0
%add2 = fadd double %x, %y
%foo = fadd double %add1, %add2
@@ -12,9 +15,12 @@ define double @test1(double %x, double %y) {
}
define double @test2(double %x, double %y) {
-; CHECK: @test2(double %x, double %y)
-; CHECK: %add1 = fadd double %x, %y, !fpmath ![[MD0:[0-9]+]]
-; CHECK: %foo = fadd double %add1, %add1
+; CHECK-LABEL: define double @test2(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: [[ADD1:%.*]] = fadd double [[X]], [[Y]], !fpmath [[META0:![0-9]+]]
+; CHECK-NEXT: [[FOO:%.*]] = fadd double [[ADD1]], [[ADD1]]
+; CHECK-NEXT: ret double [[FOO]]
+;
%add1 = fadd double %x, %y, !fpmath !0
%add2 = fadd double %x, %y, !fpmath !0
%foo = fadd double %add1, %add2
@@ -22,9 +28,12 @@ define double @test2(double %x, double %y) {
}
define double @test3(double %x, double %y) {
-; CHECK: @test3(double %x, double %y)
-; CHECK: %add1 = fadd double %x, %y, !fpmath ![[MD1:[0-9]+]]
-; CHECK: %foo = fadd double %add1, %add1
+; CHECK-LABEL: define double @test3(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: [[ADD1:%.*]] = fadd double [[X]], [[Y]], !fpmath [[META1:![0-9]+]]
+; CHECK-NEXT: [[FOO:%.*]] = fadd double [[ADD1]], [[ADD1]]
+; CHECK-NEXT: ret double [[FOO]]
+;
%add1 = fadd double %x, %y, !fpmath !1
%add2 = fadd double %x, %y, !fpmath !0
%foo = fadd double %add1, %add2
@@ -32,9 +41,12 @@ define double @test3(double %x, double %y) {
}
define double @test4(double %x, double %y) {
-; CHECK: @test4(double %x, double %y)
-; CHECK: %add1 = fadd double %x, %y, !fpmath ![[MD1]]
-; CHECK: %foo = fadd double %add1, %add1
+; CHECK-LABEL: define double @test4(
+; CHECK-SAME: double [[X:%.*]], double [[Y:%.*]]) {
+; CHECK-NEXT: [[ADD1:%.*]] = fadd double [[X]], [[Y]], !fpmath [[META1]]
+; CHECK-NEXT: [[FOO:%.*]] = fadd double [[ADD1]], [[ADD1]]
+; CHECK-NEXT: ret double [[FOO]]
+;
%add1 = fadd double %x, %y, !fpmath !0
%add2 = fadd double %x, %y, !fpmath !1
%foo = fadd double %add1, %add2
@@ -42,17 +54,22 @@ define double @test4(double %x, double %y) {
}
define double @test5(double %x) {
-; CHECK: @test5(double %x)
-; CHECK: %neg1 = fneg double %x, !fpmath ![[MD1]]
-; CHECK: %foo = fadd double %neg1, %neg1
+; CHECK-LABEL: define double @test5(
+; CHECK-SAME: double [[X:%.*]]) {
+; CHECK-NEXT: [[NEG1:%.*]] = fneg double [[X]], !fpmath [[META1]]
+; CHECK-NEXT: [[FOO:%.*]] = fadd double [[NEG1]], [[NEG1]]
+; CHECK-NEXT: ret double [[FOO]]
+;
%neg1 = fneg double %x, !fpmath !0
%neg2 = fneg double %x, !fpmath !1
%foo = fadd double %neg1, %neg2
ret double %foo
}
-; CHECK: ![[MD0]] = !{float 5.000000e+00}
-; CHECK: ![[MD1]] = !{float 2.500000e+00}
!0 = !{ float 5.0 }
!1 = !{ float 2.5 }
+;.
+; CHECK: [[META0]] = !{float 5.000000e+00}
+; CHECK: [[META1]] = !{float 2.500000e+00}
+;.
diff --git a/llvm/test/Transforms/NewGVN/funclet.ll b/llvm/test/Transforms/NewGVN/funclet.ll
index 3df3f940ec2d79..8c1cbd6b08fd7f 100644
--- a/llvm/test/Transforms/NewGVN/funclet.ll
+++ b/llvm/test/Transforms/NewGVN/funclet.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc"
@@ -8,13 +9,35 @@ target triple = "i686-pc-windows-msvc"
@"_TI1?AUA@@" = external constant %eh.ThrowInfo
define i8 @f() personality ptr @__CxxFrameHandler3 {
+; CHECK-LABEL: define i8 @f() personality ptr @__CxxFrameHandler3 {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = alloca i8, align 1
+; CHECK-NEXT: [[C:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[B]], align 1
+; CHECK-NEXT: store i8 13, ptr [[C]], align 1
+; CHECK-NEXT: invoke void @_CxxThrowException(ptr [[B]], ptr nonnull @"_TI1?AUA@@")
+; CHECK-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
+; CHECK: catch.dispatch:
+; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catch] unwind to caller
+; CHECK: catch:
+; CHECK-NEXT: [[CATCHPAD:%.*]] = catchpad within [[CS1]] [ptr null, i32 64, ptr null]
+; CHECK-NEXT: store i8 5, ptr [[B]], align 1
+; CHECK-NEXT: catchret from [[CATCHPAD]] to label [[TRY_CONT:%.*]]
+; CHECK: try.cont:
+; CHECK-NEXT: [[LOAD_B:%.*]] = load i8, ptr [[B]], align 1
+; CHECK-NEXT: [[LOAD_C:%.*]] = load i8, ptr [[C]], align 1
+; CHECK-NEXT: [[ADD:%.*]] = add i8 [[LOAD_B]], [[LOAD_C]]
+; CHECK-NEXT: ret i8 [[ADD]]
+; CHECK: unreachable:
+; CHECK-NEXT: unreachable
+;
entry:
%b = alloca i8
%c = alloca i8
store i8 42, ptr %b
store i8 13, ptr %c
invoke void @_CxxThrowException(ptr %b, ptr nonnull @"_TI1?AUA@@")
- to label %unreachable unwind label %catch.dispatch
+ to label %unreachable unwind label %catch.dispatch
catch.dispatch: ; preds = %entry
%cs1 = catchswitch within none [label %catch] unwind to caller
@@ -33,11 +56,6 @@ try.cont: ; preds = %catch
unreachable: ; preds = %entry
unreachable
}
-; CHECK-LABEL: define i8 @f(
-; CHECK: %[[load_b:.*]] = load i8, ptr %b
-; CHECK-NEXT: %[[load_c:.*]] = load i8, ptr %c
-; CHECK-NEXT: %[[add:.*]] = add i8 %[[load_b]], %[[load_c]]
-; CHECK-NEXT: ret i8 %[[add]]
declare i32 @__CxxFrameHandler3(...)
diff --git a/llvm/test/Transforms/NewGVN/int_sideeffect.ll b/llvm/test/Transforms/NewGVN/int_sideeffect.ll
index f715d022ba010a..a2c54bd38e93c5 100644
--- a/llvm/test/Transforms/NewGVN/int_sideeffect.ll
+++ b/llvm/test/Transforms/NewGVN/int_sideeffect.ll
@@ -1,27 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S < %s -passes=newgvn | FileCheck %s
declare void @llvm.sideeffect()
; Store-to-load forwarding across a @llvm.sideeffect.
-; CHECK-LABEL: s2l
-; CHECK-NOT: load
define float @s2l(ptr %p) {
- store float 0.0, ptr %p
- call void @llvm.sideeffect()
- %t = load float, ptr %p
- ret float %t
+; CHECK-LABEL: define float @s2l(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT: store float 0.000000e+00, ptr [[P]], align 4
+; CHECK-NEXT: call void @llvm.sideeffect()
+; CHECK-NEXT: ret float 0.000000e+00
+;
+ store float 0.0, ptr %p
+ call void @llvm.sideeffect()
+ %t = load float, ptr %p
+ ret float %t
}
; Redundant load elimination across a @llvm.sideeffect.
-; CHECK-LABEL: rle
-; CHECK: load
-; CHECK-NOT: load
define float @rle(ptr %p) {
- %r = load float, ptr %p
- call void @llvm.sideeffect()
- %s = load float, ptr %p
- %t = fadd float %r, %s
- ret float %t
+; CHECK-LABEL: define float @rle(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT: [[R:%.*]] = load float, ptr [[P]], align 4
+; CHECK-NEXT: call void @llvm.sideeffect()
+; CHECK-NEXT: [[T:%.*]] = fadd float [[R]], [[R]]
+; CHECK-NEXT: ret float [[T]]
+;
+ %r = load float, ptr %p
+ call void @llvm.sideeffect()
+ %s = load float, ptr %p
+ %t = fadd float %r, %s
+ ret float %t
}
diff --git a/llvm/test/Transforms/NewGVN/invariant.group.ll b/llvm/test/Transforms/NewGVN/invariant.group.ll
index 81e733f84ddb11..7c14059c88c677 100644
--- a/llvm/test/Transforms/NewGVN/invariant.group.ll
+++ b/llvm/test/Transforms/NewGVN/invariant.group.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
%struct.A = type { ptr }
@@ -6,86 +7,131 @@
@unknownPtr = external global i8
-; CHECK-LABEL: define i8 @simple() {
define i8 @simple() {
+; CHECK-LABEL: define i8 @simple() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0:![0-9]+]]
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: ret i8 42
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- call void @foo(ptr %ptr)
-
- %a = load i8, ptr %ptr, !invariant.group !0
- %b = load i8, ptr %ptr, !invariant.group !0
- %c = load i8, ptr %ptr, !invariant.group !0
-; CHECK: ret i8 42
- ret i8 %a
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ call void @foo(ptr %ptr)
+
+ %a = load i8, ptr %ptr, !invariant.group !0
+ %b = load i8, ptr %ptr, !invariant.group !0
+ %c = load i8, ptr %ptr, !invariant.group !0
+ ret i8 %a
}
-; CHECK-LABEL: define i8 @optimizable1() {
define i8 @optimizable1() {
+; CHECK-LABEL: define i8 @optimizable1() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: [[PTR2:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[PTR]])
+; CHECK-NEXT: call void @foo(ptr [[PTR2]])
+; CHECK-NEXT: ret i8 42
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- %ptr2 = call ptr @llvm.launder.invariant.group.p0(ptr %ptr)
- %a = load i8, ptr %ptr, !invariant.group !0
-
- call void @foo(ptr %ptr2); call to use %ptr2
-; CHECK: ret i8 42
- ret i8 %a
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ %ptr2 = call ptr @llvm.launder.invariant.group.p0(ptr %ptr)
+ %a = load i8, ptr %ptr, !invariant.group !0
+
+ call void @foo(ptr %ptr2); call to use %ptr2
+ ret i8 %a
}
-; CHECK-LABEL: define i8 @optimizable2() {
define i8 @optimizable2() {
+; CHECK-LABEL: define i8 @optimizable2() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: store i8 13, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @bar(i8 13)
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: ret i8 42
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- call void @foo(ptr %ptr)
-
- store i8 13, ptr %ptr ; can't use this store with invariant.group
- %a = load i8, ptr %ptr
- call void @bar(i8 %a) ; call to use %a
-
- call void @foo(ptr %ptr)
- %b = load i8, ptr %ptr, !invariant.group !0
-
-; CHECK: ret i8 42
- ret i8 %b
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ call void @foo(ptr %ptr)
+
+ store i8 13, ptr %ptr ; can't use this store with invariant.group
+ %a = load i8, ptr %ptr
+ call void @bar(i8 %a) ; call to use %a
+
+ call void @foo(ptr %ptr)
+ %b = load i8, ptr %ptr, !invariant.group !0
+
+ ret i8 %b
}
-; CHECK-LABEL: define i1 @proveEqualityForStrip(
define i1 @proveEqualityForStrip(ptr %a) {
+; CHECK-LABEL: define i1 @proveEqualityForStrip(
+; CHECK-SAME: ptr [[A:%.*]]) {
+; CHECK-NEXT: ret i1 true
+;
%b1 = call ptr @llvm.strip.invariant.group.p0(ptr %a)
-; CHECK-NOT: llvm.strip.invariant.group
%b2 = call ptr @llvm.strip.invariant.group.p0(ptr %a)
%r = icmp eq ptr %b1, %b2
-; CHECK: ret i1 true
ret i1 %r
}
-; CHECK-LABEL: define i8 @unoptimizable1() {
define i8 @unoptimizable1() {
+; CHECK-LABEL: define i8 @unoptimizable1() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: ret i8 [[A]]
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr
- call void @foo(ptr %ptr)
- %a = load i8, ptr %ptr, !invariant.group !0
-; CHECK: ret i8 %a
- ret i8 %a
+ %ptr = alloca i8
+ store i8 42, ptr %ptr
+ call void @foo(ptr %ptr)
+ %a = load i8, ptr %ptr, !invariant.group !0
+ ret i8 %a
}
; NewGVN doesn't support assumes.
-; CHECK-LABEL: define void @indirectLoads() {
define void @indirectLoads() {
+; CHECK-LABEL: define void @indirectLoads() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[A:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call ptr @getPointer(ptr null)
+; CHECK-NEXT: call void @_ZN1AC1Ev(ptr [[CALL]])
+; CHECK-NEXT: [[VTABLE:%.*]] = load ptr, ptr [[CALL]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: [[CMP_VTABLES:%.*]] = icmp eq ptr [[VTABLE]], getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2)
+; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_VTABLES]])
+; CHECK-NEXT: store ptr [[CALL]], ptr [[A]], align 8
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[VTABLE]], align 8
+; CHECK-NEXT: call void [[TMP0]](ptr [[CALL]])
+; CHECK-NEXT: [[VTABLE2:%.*]] = load ptr, ptr [[CALL]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[VTABLE2]], align 8
+; CHECK-NEXT: call void [[TMP1]](ptr [[CALL]])
+; CHECK-NEXT: [[VTABLE4:%.*]] = load ptr, ptr [[CALL]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[VTABLE4]], align 8
+; CHECK-NEXT: call void [[TMP2]](ptr [[CALL]])
+; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[VTABLE]], align 8
+; CHECK-NEXT: call void [[TMP3]](ptr [[CALL]])
+; CHECK-NEXT: ret void
+;
entry:
%a = alloca ptr, align 8
-
- %call = call ptr @getPointer(ptr null)
+
+ %call = call ptr @getPointer(ptr null)
call void @_ZN1AC1Ev(ptr %call)
-
-; CHECK: %vtable = load {{.*}} !invariant.group
+
%vtable = load ptr, ptr %call, align 8, !invariant.group !0
%cmp.vtables = icmp eq ptr %vtable, getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2)
call void @llvm.assume(i1 %cmp.vtables)
-
+
store ptr %call, ptr %a, align 8
%0 = load ptr, ptr %a, align 8
@@ -98,36 +144,45 @@ entry:
; FIXME: call void @_ZN1A3fooEv(
%vtable2 = load ptr, ptr %2, align 8, !invariant.group !0
%3 = load ptr, ptr %vtable2, align 8
-
+
call void %3(ptr %2)
%4 = load ptr, ptr %a, align 8
-
+
%vtable4 = load ptr, ptr %4, align 8, !invariant.group !0
%5 = load ptr, ptr %vtable4, align 8
; FIXME: call void @_ZN1A3fooEv(
call void %5(ptr %4)
-
+
%vtable5 = load ptr, ptr %call, align 8, !invariant.group !0
%6 = load ptr, ptr %vtable5, align 8
; FIXME: call void @_ZN1A3fooEv(
call void %6(ptr %4)
-
+
ret void
}
; NewGVN won't CSE loads with different pointee types.
-; CHECK-LABEL: define void @combiningBitCastWithLoad() {
define void @combiningBitCastWithLoad() {
+; CHECK-LABEL: define void @combiningBitCastWithLoad() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[A:%.*]] = alloca ptr, align 8
+; CHECK-NEXT: [[CALL:%.*]] = call ptr @getPointer(ptr null)
+; CHECK-NEXT: call void @_ZN1AC1Ev(ptr [[CALL]])
+; CHECK-NEXT: [[VTABLE:%.*]] = load ptr, ptr [[CALL]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: store ptr [[CALL]], ptr [[A]], align 8
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[VTABLE]], align 8
+; CHECK-NEXT: call void [[TMP0]](ptr [[CALL]])
+; CHECK-NEXT: ret void
+;
entry:
%a = alloca ptr, align 8
-
- %call = call ptr @getPointer(ptr null)
+
+ %call = call ptr @getPointer(ptr null)
call void @_ZN1AC1Ev(ptr %call)
-
-; CHECK: %vtable = load {{.*}} !invariant.group
+
%vtable = load ptr, ptr %call, align 8, !invariant.group !0
%cmp.vtables = icmp eq ptr %vtable, getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2)
-
+
store ptr %call, ptr %a, align 8
; FIXME-NOT: !invariant.group
%0 = load ptr, ptr %a, align 8
@@ -139,173 +194,245 @@ entry:
ret void
}
-; CHECK-LABEL:define void @loadCombine() {
define void @loadCombine() {
+; CHECK-LABEL: define void @loadCombine() {
+; CHECK-NEXT: enter:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[A]])
+; CHECK-NEXT: call void @bar(i8 [[A]])
+; CHECK-NEXT: ret void
+;
enter:
%ptr = alloca i8
store i8 42, ptr %ptr
call void @foo(ptr %ptr)
-; CHECK: %[[A:.*]] = load i8, ptr %ptr, align 1, !invariant.group
%a = load i8, ptr %ptr, !invariant.group !0
-; CHECK-NOT: load
%b = load i8, ptr %ptr, !invariant.group !0
-; CHECK: call void @bar(i8 %[[A]])
call void @bar(i8 %a)
-; CHECK: call void @bar(i8 %[[A]])
call void @bar(i8 %b)
ret void
}
-; CHECK-LABEL: define void @loadCombine1() {
define void @loadCombine1() {
+; CHECK-LABEL: define void @loadCombine1() {
+; CHECK-NEXT: enter:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[C:%.*]] = load i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[C]])
+; CHECK-NEXT: call void @bar(i8 [[C]])
+; CHECK-NEXT: ret void
+;
enter:
%ptr = alloca i8
store i8 42, ptr %ptr
call void @foo(ptr %ptr)
-; CHECK: %[[D:.*]] = load i8, ptr %ptr, align 1, !invariant.group
%c = load i8, ptr %ptr
-; CHECK-NOT: load
%d = load i8, ptr %ptr, !invariant.group !0
-; CHECK: call void @bar(i8 %[[D]])
call void @bar(i8 %c)
-; CHECK: call void @bar(i8 %[[D]])
call void @bar(i8 %d)
ret void
}
-; CHECK-LABEL: define void @loadCombine2() {
define void @loadCombine2() {
+; CHECK-LABEL: define void @loadCombine2() {
+; CHECK-NEXT: enter:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[E:%.*]] = load i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[E]])
+; CHECK-NEXT: call void @bar(i8 [[E]])
+; CHECK-NEXT: ret void
+;
enter:
%ptr = alloca i8
store i8 42, ptr %ptr
call void @foo(ptr %ptr)
-; CHECK: %[[E:.*]] = load i8, ptr %ptr, align 1, !invariant.group
%e = load i8, ptr %ptr, !invariant.group !0
-; CHECK-NOT: load
%f = load i8, ptr %ptr
-; CHECK: call void @bar(i8 %[[E]])
call void @bar(i8 %e)
-; CHECK: call void @bar(i8 %[[E]])
call void @bar(i8 %f)
ret void
}
-; CHECK-LABEL: define void @loadCombine3() {
define void @loadCombine3() {
+; CHECK-LABEL: define void @loadCombine3() {
+; CHECK-NEXT: enter:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[E:%.*]] = load i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[E]])
+; CHECK-NEXT: call void @bar(i8 [[E]])
+; CHECK-NEXT: ret void
+;
enter:
%ptr = alloca i8
store i8 42, ptr %ptr
call void @foo(ptr %ptr)
-; CHECK: %[[E:.*]] = load i8, ptr %ptr, align 1, !invariant.group
%e = load i8, ptr %ptr, !invariant.group !0
-; CHECK-NOT: load
%f = load i8, ptr %ptr, !invariant.group !0
-; CHECK: call void @bar(i8 %[[E]])
call void @bar(i8 %e)
-; CHECK: call void @bar(i8 %[[E]])
call void @bar(i8 %f)
ret void
}
-; CHECK-LABEL: define i8 @unoptimizable2() {
define i8 @unoptimizable2() {
+; CHECK-LABEL: define i8 @unoptimizable2() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: ret i8 [[A]]
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr
- call void @foo(ptr %ptr)
- %a = load i8, ptr %ptr
- call void @foo(ptr %ptr)
- %b = load i8, ptr %ptr, !invariant.group !0
-
-; CHECK: ret i8 %a
- ret i8 %a
+ %ptr = alloca i8
+ store i8 42, ptr %ptr
+ call void @foo(ptr %ptr)
+ %a = load i8, ptr %ptr
+ call void @foo(ptr %ptr)
+ %b = load i8, ptr %ptr, !invariant.group !0
+
+ ret i8 %a
}
-; CHECK-LABEL: define i8 @unoptimizable3() {
define i8 @unoptimizable3() {
+; CHECK-LABEL: define i8 @unoptimizable3() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: [[PTR2:%.*]] = call ptr @getPointer(ptr [[PTR]])
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR2]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: ret i8 [[A]]
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- %ptr2 = call ptr @getPointer(ptr %ptr)
- %a = load i8, ptr %ptr2, !invariant.group !0
-
-; CHECK: ret i8 %a
- ret i8 %a
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ %ptr2 = call ptr @getPointer(ptr %ptr)
+ %a = load i8, ptr %ptr2, !invariant.group !0
+
+ ret i8 %a
}
; NewGVN cares about the launder for some reason.
-; CHECK-LABEL: define i8 @optimizable4() {
define i8 @optimizable4() {
+; CHECK-LABEL: define i8 @optimizable4() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1
+; CHECK-NEXT: [[PTR2:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[PTR]])
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR2]], align 1
+; CHECK-NEXT: ret i8 [[A]]
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr
- %ptr2 = call ptr @llvm.launder.invariant.group.p0(ptr %ptr)
+ %ptr = alloca i8
+ store i8 42, ptr %ptr
+ %ptr2 = call ptr @llvm.launder.invariant.group.p0(ptr %ptr)
; FIXME-NOT: load
- %a = load i8, ptr %ptr2
-
+ %a = load i8, ptr %ptr2
+
; FIXME: ret i8 42
- ret i8 %a
+ ret i8 %a
}
-; CHECK-LABEL: define i8 @volatile1() {
define i8 @volatile1() {
+; CHECK-LABEL: define i8 @volatile1() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[B:%.*]] = load volatile i8, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @bar(i8 [[B]])
+; CHECK-NEXT: [[C:%.*]] = load volatile i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[C]])
+; CHECK-NEXT: ret i8 42
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- call void @foo(ptr %ptr)
- %a = load i8, ptr %ptr, !invariant.group !0
- %b = load volatile i8, ptr %ptr
-; CHECK: call void @bar(i8 %b)
- call void @bar(i8 %b)
-
- %c = load volatile i8, ptr %ptr, !invariant.group !0
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ call void @foo(ptr %ptr)
+ %a = load i8, ptr %ptr, !invariant.group !0
+ %b = load volatile i8, ptr %ptr
+ call void @bar(i8 %b)
+
+ %c = load volatile i8, ptr %ptr, !invariant.group !0
; We might be able to optimize this, but nobody cares
-; CHECK: call void @bar(i8 %c)
- call void @bar(i8 %c)
-; CHECK: ret i8 42
- ret i8 %a
+ call void @bar(i8 %c)
+ ret i8 %a
}
-; CHECK-LABEL: define i8 @volatile2() {
define i8 @volatile2() {
+; CHECK-LABEL: define i8 @volatile2() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: [[B:%.*]] = load volatile i8, ptr [[PTR]], align 1
+; CHECK-NEXT: call void @bar(i8 [[B]])
+; CHECK-NEXT: [[C:%.*]] = load volatile i8, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[C]])
+; CHECK-NEXT: ret i8 42
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- call void @foo(ptr %ptr)
- %a = load i8, ptr %ptr, !invariant.group !0
- %b = load volatile i8, ptr %ptr
-; CHECK: call void @bar(i8 %b)
- call void @bar(i8 %b)
-
- %c = load volatile i8, ptr %ptr, !invariant.group !0
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ call void @foo(ptr %ptr)
+ %a = load i8, ptr %ptr, !invariant.group !0
+ %b = load volatile i8, ptr %ptr
+ call void @bar(i8 %b)
+
+ %c = load volatile i8, ptr %ptr, !invariant.group !0
; We might be able to optimize this, but nobody cares
-; CHECK: call void @bar(i8 %c)
- call void @bar(i8 %c)
-; CHECK: ret i8 42
- ret i8 %a
+ call void @bar(i8 %c)
+ ret i8 %a
}
-; CHECK-LABEL: define void @fun() {
define void @fun() {
+; CHECK-LABEL: define void @fun() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[PTR:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 42, ptr [[PTR]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo(ptr [[PTR]])
+; CHECK-NEXT: call void @bar(i8 42)
+; CHECK-NEXT: ret void
+;
entry:
- %ptr = alloca i8
- store i8 42, ptr %ptr, !invariant.group !0
- call void @foo(ptr %ptr)
+ %ptr = alloca i8
+ store i8 42, ptr %ptr, !invariant.group !0
+ call void @foo(ptr %ptr)
- %a = load i8, ptr %ptr, !invariant.group !0 ; Can assume that value under %ptr didn't change
-; CHECK: call void @bar(i8 42)
- call void @bar(i8 %a)
+ %a = load i8, ptr %ptr, !invariant.group !0 ; Can assume that value under %ptr didn't change
+ call void @bar(i8 %a)
- ret void
+ ret void
}
; FIXME: NewGVN doesn't run instsimplify on a load from a vtable definition?
; This test checks if invariant.group understands gep with zeros
-; CHECK-LABEL: define void @testGEP0() {
define void @testGEP0() {
+; CHECK-LABEL: define void @testGEP0() {
+; CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT_A:%.*]], align 8
+; CHECK-NEXT: store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), ptr [[A]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: call void @_ZN1A3fooEv(ptr nonnull dereferenceable(8) [[A]])
+; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr @unknownPtr, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TMP2]], label [[_Z1GR1A_EXIT:%.*]], label [[TMP3:%.*]]
+; CHECK: 3:
+; CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), align 8
+; CHECK-NEXT: call void [[TMP4]](ptr nonnull [[A]])
+; CHECK-NEXT: br label [[_Z1GR1A_EXIT]]
+; CHECK: _Z1gR1A.exit:
+; CHECK-NEXT: ret void
+;
%a = alloca %struct.A, align 8
store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), ptr %a, align 8, !invariant.group !0
-; CHECK: call void @_ZN1A3fooEv(ptr nonnull dereferenceable(8) %a)
call void @_ZN1A3fooEv(ptr nonnull dereferenceable(8) %a) ; This call may change vptr
%1 = load i8, ptr @unknownPtr, align 4
%2 = icmp eq i8 %1, 0
@@ -325,54 +452,93 @@ _Z1gR1A.exit: ; preds = %0, %3
; Check if no optimizations are performed with global pointers.
; FIXME: we could do the optimizations if we would check if dependency comes
; from the same function.
-; CHECK-LABEL: define void @testGlobal() {
define void @testGlobal() {
-; CHECK: %a = load i8, ptr @unknownPtr, align 1, !invariant.group !0
- %a = load i8, ptr @unknownPtr, !invariant.group !0
- call void @foo2(ptr @unknownPtr, i8 %a)
-; CHECK: %1 = load i8, ptr @unknownPtr, align 1, !invariant.group !0
- %1 = load i8, ptr @unknownPtr, !invariant.group !0
- call void @bar(i8 %1)
-
- call void @fooBit(ptr @unknownPtr, i1 1)
+; CHECK-LABEL: define void @testGlobal() {
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr @unknownPtr, align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo2(ptr @unknownPtr, i8 [[A]])
+; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr @unknownPtr, align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @bar(i8 [[TMP1]])
+; CHECK-NEXT: call void @fooBit(ptr @unknownPtr, i1 true)
+; CHECK-NEXT: [[TMP2:%.*]] = load i1, ptr @unknownPtr, align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @fooBit(ptr @unknownPtr, i1 [[TMP2]])
+; CHECK-NEXT: [[TMP3:%.*]] = load i1, ptr @unknownPtr, align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @fooBit(ptr @unknownPtr, i1 [[TMP3]])
+; CHECK-NEXT: ret void
+;
+ %a = load i8, ptr @unknownPtr, !invariant.group !0
+ call void @foo2(ptr @unknownPtr, i8 %a)
+ %1 = load i8, ptr @unknownPtr, !invariant.group !0
+ call void @bar(i8 %1)
+
+ call void @fooBit(ptr @unknownPtr, i1 1)
; Adding regex because of canonicalization of bitcasts
-; CHECK: %2 = load i1, ptr {{.*}}, !invariant.group !0
- %2 = load i1, ptr @unknownPtr, !invariant.group !0
- call void @fooBit(ptr @unknownPtr, i1 %2)
-; CHECK: %3 = load i1, ptr {{.*}}, !invariant.group !0
- %3 = load i1, ptr @unknownPtr, !invariant.group !0
- call void @fooBit(ptr @unknownPtr, i1 %3)
- ret void
+ %2 = load i1, ptr @unknownPtr, !invariant.group !0
+ call void @fooBit(ptr @unknownPtr, i1 %2)
+ %3 = load i1, ptr @unknownPtr, !invariant.group !0
+ call void @fooBit(ptr @unknownPtr, i1 %3)
+ ret void
}
; Might be similar to above where NewGVN doesn't handle loads of different types from the same location.
; Not super important anyway.
-; CHECK-LABEL: define void @testTrunc() {
define void @testTrunc() {
- %a = alloca i8
- call void @foo(ptr %a)
-; CHECK: %b = load i8, ptr %a, align 1, !invariant.group !0
- %b = load i8, ptr %a, !invariant.group !0
- call void @foo2(ptr %a, i8 %b)
-
- %1 = load i8, ptr %a, !invariant.group !0
-; CHECK: call void @bar(i8 %b)
- call void @bar(i8 %1)
-
- call void @fooBit(ptr %a, i1 1)
+; CHECK-LABEL: define void @testTrunc() {
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: call void @foo(ptr [[A]])
+; CHECK-NEXT: [[B:%.*]] = load i8, ptr [[A]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @foo2(ptr [[A]], i8 [[B]])
+; CHECK-NEXT: call void @bar(i8 [[B]])
+; CHECK-NEXT: call void @fooBit(ptr [[A]], i1 true)
+; CHECK-NEXT: [[TMP1:%.*]] = load i1, ptr [[A]], align 1, !invariant.group [[META0]]
+; CHECK-NEXT: call void @fooBit(ptr [[A]], i1 [[TMP1]])
+; CHECK-NEXT: call void @fooBit(ptr [[A]], i1 [[TMP1]])
+; CHECK-NEXT: ret void
+;
+ %a = alloca i8
+ call void @foo(ptr %a)
+ %b = load i8, ptr %a, !invariant.group !0
+ call void @foo2(ptr %a, i8 %b)
+
+ %1 = load i8, ptr %a, !invariant.group !0
+ call void @bar(i8 %1)
+
+ call void @fooBit(ptr %a, i1 1)
; FIXME: %1 = trunc i8 %b to i1
- %2 = load i1, ptr %a, !invariant.group !0
+ %2 = load i1, ptr %a, !invariant.group !0
; FIXME-NEXT: call void @fooBit(ptr %a, i1 %1)
- call void @fooBit(ptr %a, i1 %2)
- %3 = load i1, ptr %a, !invariant.group !0
+ call void @fooBit(ptr %a, i1 %2)
+ %3 = load i1, ptr %a, !invariant.group !0
; FIXME-NEXT: call void @fooBit(ptr %a, i1 %1)
- call void @fooBit(ptr %a, i1 %3)
- ret void
+ call void @fooBit(ptr %a, i1 %3)
+ ret void
}
; See comment in @testGEP0 on what NewGVN is lacking.
-; CHECK-LABEL: define void @handling_loops()
define void @handling_loops() {
+; CHECK-LABEL: define void @handling_loops() {
+; CHECK-NEXT: [[A:%.*]] = alloca [[STRUCT_A:%.*]], align 8
+; CHECK-NEXT: store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), ptr [[A]], align 8, !invariant.group [[META0]]
+; CHECK-NEXT: [[TMP1:%.*]] = load i8, ptr @unknownPtr, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i8 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TMP2]], label [[DOTLR_PH_I:%.*]], label [[_Z2G2R1A_EXIT:%.*]]
+; CHECK: .lr.ph.i:
+; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i8 [[TMP1]], 1
+; CHECK-NEXT: br i1 [[TMP3]], label [[DOT_CRIT_EDGE_PREHEADER:%.*]], label [[_Z2G2R1A_EXIT]]
+; CHECK: ._crit_edge.preheader:
+; CHECK-NEXT: br label [[DOT_CRIT_EDGE:%.*]]
+; CHECK: ._crit_edge:
+; CHECK-NEXT: [[TMP4:%.*]] = phi i8 [ [[TMP6:%.*]], [[DOT_CRIT_EDGE]] ], [ 1, [[DOT_CRIT_EDGE_PREHEADER]] ]
+; CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), align 8
+; CHECK-NEXT: call void [[TMP5]](ptr nonnull [[A]])
+; CHECK-NEXT: [[TMP6]] = add nuw nsw i8 [[TMP4]], 1
+; CHECK-NEXT: [[TMP7:%.*]] = load i8, ptr @unknownPtr, align 4
+; CHECK-NEXT: [[TMP8:%.*]] = icmp slt i8 [[TMP6]], [[TMP7]]
+; CHECK-NEXT: br i1 [[TMP8]], label [[DOT_CRIT_EDGE]], label [[_Z2G2R1A_EXIT_LOOPEXIT:%.*]]
+; CHECK: _Z2g2R1A.exit.loopexit:
+; CHECK-NEXT: br label [[_Z2G2R1A_EXIT]]
+; CHECK: _Z2g2R1A.exit:
+; CHECK-NEXT: ret void
+;
%a = alloca %struct.A, align 8
store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1A, i64 0, i64 2), ptr %a, align 8, !invariant.group !0
%1 = load i8, ptr @unknownPtr, align 4
@@ -424,3 +590,6 @@ declare void @llvm.assume(i1 %cmp.vtables) #0
attributes #0 = { nounwind }
!0 = !{}
+;.
+; CHECK: [[META0]] = !{}
+;.
diff --git a/llvm/test/Transforms/NewGVN/invariant.start.ll b/llvm/test/Transforms/NewGVN/invariant.start.ll
index 100b79fd3bff28..9bf1c5530006bd 100644
--- a/llvm/test/Transforms/NewGVN/invariant.start.ll
+++ b/llvm/test/Transforms/NewGVN/invariant.start.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; Test to make sure llvm.invariant.start calls are not treated as clobbers.
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
@@ -7,10 +8,12 @@ declare void @llvm.invariant.end.p0(ptr, i64, ptr nocapture) nounwind
; We forward store to the load across the invariant.start intrinsic
define i8 @forward_store() {
-; CHECK-LABEL: @forward_store
-; CHECK: call ptr @llvm.invariant.start.p0(i64 1, ptr %a)
-; CHECK-NOT: load
-; CHECK: ret i8 0
+; CHECK-LABEL: define i8 @forward_store() {
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 0, ptr [[A]], align 1
+; CHECK-NEXT: [[I:%.*]] = call ptr @llvm.invariant.start.p0(i64 1, ptr [[A]])
+; CHECK-NEXT: ret i8 0
+;
%a = alloca i8
store i8 0, ptr %a
%i = call ptr @llvm.invariant.start.p0(i64 1, ptr %a)
@@ -23,10 +26,18 @@ declare i8 @dummy(ptr nocapture) nounwind readonly
; We forward store to the load in the non-local analysis case,
; i.e. invariant.start is in another basic block.
define i8 @forward_store_nonlocal(i1 %cond) {
-; CHECK-LABEL: forward_store_nonlocal
-; CHECK: call ptr @llvm.invariant.start.p0(i64 1, ptr %a)
-; CHECK: ret i8 0
-; CHECK: ret i8 %val
+; CHECK-LABEL: define i8 @forward_store_nonlocal(
+; CHECK-SAME: i1 [[COND:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 0, ptr [[A]], align 1
+; CHECK-NEXT: [[I:%.*]] = call ptr @llvm.invariant.start.p0(i64 1, ptr [[A]])
+; CHECK-NEXT: br i1 [[COND]], label [[LOADBLOCK:%.*]], label [[EXIT:%.*]]
+; CHECK: loadblock:
+; CHECK-NEXT: ret i8 0
+; CHECK: exit:
+; CHECK-NEXT: [[VAL:%.*]] = call i8 @dummy(ptr [[A]])
+; CHECK-NEXT: ret i8 [[VAL]]
+;
%a = alloca i8
store i8 0, ptr %a
%i = call ptr @llvm.invariant.start.p0(i64 1, ptr %a)
@@ -43,12 +54,14 @@ exit:
; We should not value forward %foo to the invariant.end corresponding to %bar.
define i8 @forward_store1() {
-; CHECK-LABEL: forward_store1
-; CHECK: %foo = call ptr @llvm.invariant.start.p0
-; CHECK-NOT: load
-; CHECK: %bar = call ptr @llvm.invariant.start.p0
-; CHECK: call void @llvm.invariant.end.p0(ptr %bar, i64 1, ptr %a)
-; CHECK: ret i8 0
+; CHECK-LABEL: define i8 @forward_store1() {
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 0, ptr [[A]], align 1
+; CHECK-NEXT: [[FOO:%.*]] = call ptr @llvm.invariant.start.p0(i64 1, ptr [[A]])
+; CHECK-NEXT: [[BAR:%.*]] = call ptr @llvm.invariant.start.p0(i64 1, ptr [[A]])
+; CHECK-NEXT: call void @llvm.invariant.end.p0(ptr [[BAR]], i64 1, ptr [[A]])
+; CHECK-NEXT: ret i8 0
+;
%a = alloca i8
store i8 0, ptr %a
%foo = call ptr @llvm.invariant.start.p0(i64 1, ptr %a)
diff --git a/llvm/test/Transforms/NewGVN/lifetime-simple.ll b/llvm/test/Transforms/NewGVN/lifetime-simple.ll
index 5d31101218ee67..55e46111fc9c93 100644
--- a/llvm/test/Transforms/NewGVN/lifetime-simple.ll
+++ b/llvm/test/Transforms/NewGVN/lifetime-simple.ll
@@ -1,12 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin7"
define i8 @test(ptr %P) nounwind {
-; CHECK: lifetime.start
-; CHECK-NOT: load
-; CHECK: lifetime.end
+; CHECK-LABEL: define i8 @test(
+; CHECK-SAME: ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 32, ptr [[P]])
+; CHECK-NEXT: store i8 1, ptr [[P]], align 1
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 32, ptr [[P]])
+; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[P]], align 1
+; CHECK-NEXT: ret i8 [[TMP0]]
+;
entry:
call void @llvm.lifetime.start.p0(i64 32, ptr %P)
%0 = load i8, ptr %P
diff --git a/llvm/test/Transforms/NewGVN/load-constant-mem.ll b/llvm/test/Transforms/NewGVN/load-constant-mem.ll
index 06439c59f9d2d7..ae91147237fade 100644
--- a/llvm/test/Transforms/NewGVN/load-constant-mem.ll
+++ b/llvm/test/Transforms/NewGVN/load-constant-mem.ll
@@ -7,14 +7,14 @@ define i32 @test(ptr %p, i32 %i) nounwind {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[P:%.*]] = getelementptr [4 x i32], ptr @G, i32 0, i32 [[I:%.*]]
-; CHECK-NEXT: store i8 4, ptr [[P:%.*]]
+; CHECK-NEXT: store i8 4, ptr [[P1:%.*]], align 1
; CHECK-NEXT: ret i32 0
;
entry:
- %P = getelementptr [4 x i32], ptr @G, i32 0, i32 %i
- %A = load i32, ptr %P
+ %p.i = getelementptr [4 x i32], ptr @G, i32 0, i32 %i
+ %A = load i32, ptr %p.i
store i8 4, ptr %p
- %B = load i32, ptr %P
+ %B = load i32, ptr %p.i
%C = sub i32 %A, %B
ret i32 %C
}
diff --git a/llvm/test/Transforms/NewGVN/load-from-unreachable-predecessor.ll b/llvm/test/Transforms/NewGVN/load-from-unreachable-predecessor.ll
index 74cb70066eb1dc..3ca9b9efbe4c26 100644
--- a/llvm/test/Transforms/NewGVN/load-from-unreachable-predecessor.ll
+++ b/llvm/test/Transforms/NewGVN/load-from-unreachable-predecessor.ll
@@ -1,12 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
; Check that an unreachable predecessor to a PHI node doesn't cause a crash.
; PR21625.
define i32 @f(ptr %f) {
-; CHECK: bb0:
+; CHECK-LABEL: define i32 @f(
+; CHECK-SAME: ptr [[F:%.*]]) {
+; CHECK-NEXT: bb0:
+; CHECK-NEXT: br label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br i1 false, label [[BB1:%.*]], label [[BB2]]
+; CHECK: bb2:
+; CHECK-NEXT: [[STOREMERGE:%.*]] = load i32, ptr null, align 4
+; CHECK-NEXT: ret i32 [[STOREMERGE]]
+;
; Load should be removed, since it's ignored.
-; CHECK-NEXT: br label
bb0:
%bar = load ptr, ptr %f
br label %bb2
diff --git a/llvm/test/Transforms/NewGVN/loadforward.ll b/llvm/test/Transforms/NewGVN/loadforward.ll
index d8a9022dc66f6b..85ceafd433f45a 100644
--- a/llvm/test/Transforms/NewGVN/loadforward.ll
+++ b/llvm/test/Transforms/NewGVN/loadforward.ll
@@ -9,8 +9,8 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
;; Test that we forward the first store to the second load
define i16 @bazinga() {
; CHECK-LABEL: @bazinga(
-; CHECK-NEXT: [[_TMP10:%.*]] = load i16, ptr getelementptr inbounds (%rec11, ptr @str, i64 0, i32 1)
-; CHECK-NEXT: store i16 [[_TMP10]], ptr @str
+; CHECK-NEXT: [[_TMP10:%.*]] = load i16, ptr getelementptr inbounds ([[REC11:%.*]], ptr @str, i64 0, i32 1), align 2
+; CHECK-NEXT: store i16 [[_TMP10]], ptr @str, align 2
; CHECK-NEXT: [[_TMP15:%.*]] = icmp eq i16 [[_TMP10]], 3
; CHECK-NEXT: [[_TMP16:%.*]] = select i1 [[_TMP15]], i16 1, i16 0
; CHECK-NEXT: br label [[BB1:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/malloc-load-removal.ll b/llvm/test/Transforms/NewGVN/malloc-load-removal.ll
index b487acfe93e476..3e11d9221c9dd2 100644
--- a/llvm/test/Transforms/NewGVN/malloc-load-removal.ll
+++ b/llvm/test/Transforms/NewGVN/malloc-load-removal.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn < %s | FileCheck %s
; PR13694
@@ -7,6 +8,17 @@ target triple = "x86_64-apple-macosx10.8.0"
declare ptr @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"
define noalias ptr @test1() nounwind uwtable ssp {
+; CHECK-LABEL: define noalias ptr @test1(
+; CHECK-SAME: ) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CALL:%.*]] = tail call ptr @malloc(i64 100) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: br i1 undef, label [[IF_END:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i8 0, ptr [[CALL]], align 1
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: ret ptr [[CALL]]
+;
entry:
%call = tail call ptr @malloc(i64 100) nounwind
%0 = load i8, ptr %call, align 1
@@ -20,14 +32,22 @@ if.then: ; preds = %entry
if.end: ; preds = %if.then, %entry
ret ptr %call
-; CHECK-LABEL: @test1(
-; CHECK-NOT: load
-; CHECK-NOT: icmp
}
declare ptr @_Znwm(i64) nounwind
define noalias ptr @test2() nounwind uwtable ssp {
+; CHECK-LABEL: define noalias ptr @test2(
+; CHECK-SAME: ) #[[ATTR1]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CALL:%.*]] = tail call ptr @_Znwm(i64 100) #[[ATTR2]]
+; CHECK-NEXT: br i1 undef, label [[IF_END:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i8 0, ptr [[CALL]], align 1
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: ret ptr [[CALL]]
+;
entry:
%call = tail call ptr @_Znwm(i64 100) nounwind
%0 = load i8, ptr %call, align 1
@@ -41,14 +61,22 @@ if.then: ; preds = %entry
if.end: ; preds = %if.then, %entry
ret ptr %call
-; CHECK-LABEL: @test2(
-; CHECK-NOT: load
-; CHECK-NOT: icmp
}
declare ptr @aligned_alloc(i64 allocalign, i64) nounwind allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"
define noalias ptr @test3() nounwind uwtable ssp {
+; CHECK-LABEL: define noalias ptr @test3(
+; CHECK-SAME: ) #[[ATTR1]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CALL:%.*]] = tail call ptr @aligned_alloc(i64 256, i64 32) #[[ATTR2]]
+; CHECK-NEXT: br i1 undef, label [[IF_END:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: store i8 0, ptr [[CALL]], align 1
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: ret ptr [[CALL]]
+;
entry:
%call = tail call ptr @aligned_alloc(i64 256, i64 32) nounwind
%0 = load i8, ptr %call, align 32
@@ -62,7 +90,4 @@ if.then: ; preds = %entry
if.end: ; preds = %if.then, %entry
ret ptr %call
-; CHECK-LABEL: @test3(
-; CHECK-NOT: load
-; CHECK-NOT: icmp
}
diff --git a/llvm/test/Transforms/NewGVN/memory-handling.ll b/llvm/test/Transforms/NewGVN/memory-handling.ll
index b1e1c4f2de3e1d..c72ff749ba410d 100644
--- a/llvm/test/Transforms/NewGVN/memory-handling.ll
+++ b/llvm/test/Transforms/NewGVN/memory-handling.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
;; This test is really dependent on propagating a lot of memory info around, but in the end, not
;; screwing up a single add.
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
@@ -20,6 +21,121 @@ declare ptr @__ctype_b_loc() local_unnamed_addr #1
; Function Attrs: nounwind uwtable
define void @BuildMask(ptr nocapture readonly) local_unnamed_addr #0 {
+; CHECK-LABEL: define void @BuildMask(
+; CHECK-SAME: ptr nocapture readonly [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr align 16 @alPhrase, i8 0, i64 416, i1 false)
+; CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr align 16 @aqMainMask, i8 0, i64 16, i1 false)
+; CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr align 16 @aqMainSign, i8 0, i64 16, i1 false)
+; CHECK-NEXT: br label [[DOTSINK_SPLIT:%.*]]
+; CHECK: .sink.split:
+; CHECK-NEXT: [[DOT0:%.*]] = phi ptr [ [[TMP0]], [[TMP1:%.*]] ], [ [[TMP3:%.*]], [[TMP14:%.*]] ]
+; CHECK-NEXT: [[DOTSINK:%.*]] = phi i32 [ 0, [[TMP1]] ], [ [[TMP22:%.*]], [[TMP14]] ]
+; CHECK-NEXT: store i32 [[DOTSINK]], ptr @cchPhraseLength, align 4, !tbaa [[TBAA1:![0-9]+]]
+; CHECK-NEXT: br label [[TMP2:%.*]]
+; CHECK: 2:
+; CHECK-NEXT: [[DOT1:%.*]] = phi ptr [ [[DOT0]], [[DOTSINK_SPLIT]] ], [ [[TMP3]], [[TMP6:%.*]] ]
+; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, ptr [[DOT1]], i64 1
+; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[DOT1]], align 1
+; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i8 [[TMP4]], 0
+; CHECK-NEXT: br i1 [[TMP5]], label [[DOTPREHEADER_PREHEADER:%.*]], label [[TMP6]]
+; CHECK: .preheader.preheader:
+; CHECK-NEXT: br label [[DOTPREHEADER:%.*]]
+; CHECK: 6:
+; CHECK-NEXT: [[TMP7:%.*]] = tail call ptr @__ctype_b_loc() #[[ATTR4:[0-9]+]]
+; CHECK-NEXT: [[TMP8:%.*]] = load ptr, ptr [[TMP7]], align 8, !tbaa [[TBAA5:![0-9]+]]
+; CHECK-NEXT: [[TMP9:%.*]] = sext i8 [[TMP4]] to i64
+; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i16, ptr [[TMP8]], i64 [[TMP9]]
+; CHECK-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP10]], align 2, !tbaa [[TBAA7:![0-9]+]]
+; CHECK-NEXT: [[TMP12:%.*]] = and i16 [[TMP11]], 1024
+; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i16 [[TMP12]], 0
+; CHECK-NEXT: br i1 [[TMP13]], label [[TMP2]], label [[TMP14]]
+; CHECK: 14:
+; CHECK-NEXT: [[TMP15:%.*]] = sext i8 [[TMP4]] to i32
+; CHECK-NEXT: [[TMP16:%.*]] = tail call i32 @tolower(i32 [[TMP15]]) #[[ATTR5:[0-9]+]]
+; CHECK-NEXT: [[TMP17:%.*]] = add nsw i32 [[TMP16]], -97
+; CHECK-NEXT: [[TMP18:%.*]] = sext i32 [[TMP17]] to i64
+; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds [26 x %struct.Letter], ptr @alPhrase, i64 0, i64 [[TMP18]], i32 0
+; CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 16, !tbaa [[TBAA9:![0-9]+]]
+; CHECK-NEXT: [[TMP21:%.*]] = add i32 [[TMP20]], 1
+; CHECK-NEXT: store i32 [[TMP21]], ptr [[TMP19]], align 16, !tbaa [[TBAA9]]
+; CHECK-NEXT: [[TMP22]] = add nsw i32 [[DOTSINK]], 1
+; CHECK-NEXT: br label [[DOTSINK_SPLIT]]
+; CHECK: .preheader:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[DOTPREHEADER_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[TMP57:%.*]] ]
+; CHECK-NEXT: [[DOT04961:%.*]] = phi i32 [ [[DOT2:%.*]], [[TMP57]] ], [ 0, [[DOTPREHEADER_PREHEADER]] ]
+; CHECK-NEXT: [[DOT05160:%.*]] = phi i32 [ [[DOT253:%.*]], [[TMP57]] ], [ 0, [[DOTPREHEADER_PREHEADER]] ]
+; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds [26 x %struct.Letter], ptr @alPhrase, i64 0, i64 [[INDVARS_IV]], i32 0
+; CHECK-NEXT: [[TMP24:%.*]] = load i32, ptr [[TMP23]], align 16, !tbaa [[TBAA9]]
+; CHECK-NEXT: [[TMP25:%.*]] = icmp eq i32 [[TMP24]], 0
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds [26 x i32], ptr @auGlobalFrequency, i64 0, i64 [[INDVARS_IV]]
+; CHECK-NEXT: br i1 [[TMP25]], label [[TMP27:%.*]], label [[TMP28:%.*]]
+; CHECK: 27:
+; CHECK-NEXT: store i32 -1, ptr [[TMP26]], align 4, !tbaa [[TBAA1]]
+; CHECK-NEXT: br label [[TMP57]]
+; CHECK: 28:
+; CHECK-NEXT: store i32 0, ptr [[TMP26]], align 4, !tbaa [[TBAA1]]
+; CHECK-NEXT: [[TMP29:%.*]] = zext i32 [[TMP24]] to i64
+; CHECK-NEXT: br i1 false, label [[DOT_CRIT_EDGE:%.*]], label [[DOTLR_PH_PREHEADER:%.*]]
+; CHECK: .lr.ph.preheader:
+; CHECK-NEXT: br label [[DOTLR_PH:%.*]]
+; CHECK: .lr.ph:
+; CHECK-NEXT: [[DOT04658:%.*]] = phi i64 [ [[TMP31:%.*]], [[DOTLR_PH]] ], [ 1, [[DOTLR_PH_PREHEADER]] ]
+; CHECK-NEXT: [[DOT04857:%.*]] = phi i32 [ [[TMP30:%.*]], [[DOTLR_PH]] ], [ 1, [[DOTLR_PH_PREHEADER]] ]
+; CHECK-NEXT: [[TMP30]] = add nuw nsw i32 [[DOT04857]], 1
+; CHECK-NEXT: [[TMP31]] = shl i64 [[DOT04658]], 1
+; CHECK-NEXT: [[TMP32:%.*]] = icmp ult i64 [[TMP29]], [[TMP31]]
+; CHECK-NEXT: br i1 [[TMP32]], label [[DOT_CRIT_EDGE_LOOPEXIT:%.*]], label [[DOTLR_PH]]
+; CHECK: ._crit_edge.loopexit:
+; CHECK-NEXT: br label [[DOT_CRIT_EDGE]]
+; CHECK: ._crit_edge:
+; CHECK-NEXT: [[DOT048_LCSSA:%.*]] = phi i32 [ poison, [[TMP28]] ], [ [[TMP30]], [[DOT_CRIT_EDGE_LOOPEXIT]] ]
+; CHECK-NEXT: [[DOT046_LCSSA:%.*]] = phi i64 [ poison, [[TMP28]] ], [ [[TMP31]], [[DOT_CRIT_EDGE_LOOPEXIT]] ]
+; CHECK-NEXT: [[TMP33:%.*]] = add nsw i32 [[DOT048_LCSSA]], [[DOT04961]]
+; CHECK-NEXT: [[TMP34:%.*]] = icmp ugt i32 [[TMP33]], 64
+; CHECK-NEXT: br i1 [[TMP34]], label [[TMP35:%.*]], label [[TMP39:%.*]]
+; CHECK: 35:
+; CHECK-NEXT: [[TMP36:%.*]] = add i32 [[DOT05160]], 1
+; CHECK-NEXT: [[TMP37:%.*]] = icmp ugt i32 [[TMP36]], 1
+; CHECK-NEXT: br i1 [[TMP37]], label [[TMP38:%.*]], label [[TMP39]]
+; CHECK: 38:
+; CHECK-NEXT: tail call void @Fatal(ptr @.str.7, i32 0)
+; CHECK-NEXT: br label [[TMP39]]
+; CHECK: 39:
+; CHECK-NEXT: [[DOT152:%.*]] = phi i32 [ [[DOT05160]], [[DOT_CRIT_EDGE]] ], [ [[TMP36]], [[TMP38]] ], [ [[TMP36]], [[TMP35]] ]
+; CHECK-NEXT: [[DOT150:%.*]] = phi i32 [ [[DOT04961]], [[DOT_CRIT_EDGE]] ], [ 0, [[TMP38]] ], [ 0, [[TMP35]] ]
+; CHECK-NEXT: [[TMP40:%.*]] = add i64 [[DOT046_LCSSA]], 4294967295
+; CHECK-NEXT: [[TMP41:%.*]] = trunc i64 [[TMP40]] to i32
+; CHECK-NEXT: [[TMP42:%.*]] = getelementptr inbounds [26 x %struct.Letter], ptr @alPhrase, i64 0, i64 [[INDVARS_IV]], i32 2
+; CHECK-NEXT: store i32 [[TMP41]], ptr [[TMP42]], align 8, !tbaa [[TBAA11:![0-9]+]]
+; CHECK-NEXT: [[TMP43:%.*]] = zext i32 [[DOT150]] to i64
+; CHECK-NEXT: [[DOT046_:%.*]] = shl i64 [[DOT046_LCSSA]], [[TMP43]]
+; CHECK-NEXT: [[TMP44:%.*]] = zext i32 [[DOT152]] to i64
+; CHECK-NEXT: [[TMP45:%.*]] = getelementptr inbounds [2 x i64], ptr @aqMainSign, i64 0, i64 [[TMP44]]
+; CHECK-NEXT: [[TMP46:%.*]] = load i64, ptr [[TMP45]], align 8, !tbaa [[TBAA12:![0-9]+]]
+; CHECK-NEXT: [[TMP47:%.*]] = or i64 [[TMP46]], [[DOT046_]]
+; CHECK-NEXT: store i64 [[TMP47]], ptr [[TMP45]], align 8, !tbaa [[TBAA12]]
+; CHECK-NEXT: [[TMP48:%.*]] = load i32, ptr [[TMP23]], align 16, !tbaa [[TBAA9]]
+; CHECK-NEXT: [[TMP49:%.*]] = zext i32 [[TMP48]] to i64
+; CHECK-NEXT: [[TMP50:%.*]] = shl i64 [[TMP49]], [[TMP43]]
+; CHECK-NEXT: [[TMP51:%.*]] = getelementptr inbounds [2 x i64], ptr @aqMainMask, i64 0, i64 [[TMP44]]
+; CHECK-NEXT: [[TMP52:%.*]] = load i64, ptr [[TMP51]], align 8, !tbaa [[TBAA12]]
+; CHECK-NEXT: [[TMP53:%.*]] = or i64 [[TMP50]], [[TMP52]]
+; CHECK-NEXT: store i64 [[TMP53]], ptr [[TMP51]], align 8, !tbaa [[TBAA12]]
+; CHECK-NEXT: [[TMP54:%.*]] = getelementptr inbounds [26 x %struct.Letter], ptr @alPhrase, i64 0, i64 [[INDVARS_IV]], i32 1
+; CHECK-NEXT: store i32 [[DOT150]], ptr [[TMP54]], align 4, !tbaa [[TBAA14:![0-9]+]]
+; CHECK-NEXT: [[TMP55:%.*]] = getelementptr inbounds [26 x %struct.Letter], ptr @alPhrase, i64 0, i64 [[INDVARS_IV]], i32 3
+; CHECK-NEXT: store i32 [[DOT152]], ptr [[TMP55]], align 4, !tbaa [[TBAA15:![0-9]+]]
+; CHECK-NEXT: [[TMP56:%.*]] = add nsw i32 [[DOT150]], [[DOT048_LCSSA]]
+; CHECK-NEXT: br label [[TMP57]]
+; CHECK: 57:
+; CHECK-NEXT: [[DOT253]] = phi i32 [ [[DOT05160]], [[TMP27]] ], [ [[DOT152]], [[TMP39]] ]
+; CHECK-NEXT: [[DOT2]] = phi i32 [ [[DOT04961]], [[TMP27]] ], [ [[TMP56]], [[TMP39]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], 26
+; CHECK-NEXT: br i1 [[EXITCOND]], label [[DOTPREHEADER]], label [[TMP58:%.*]]
+; CHECK: 58:
+; CHECK-NEXT: ret void
+;
tail call void @llvm.memset.p0.i64(ptr align 16 @alPhrase, i8 0, i64 416, i1 false)
tail call void @llvm.memset.p0.i64(ptr align 16 @aqMainMask, i8 0, i64 16, i1 false)
tail call void @llvm.memset.p0.i64(ptr align 16 @aqMainSign, i8 0, i64 16, i1 false)
@@ -113,7 +229,6 @@ define void @BuildMask(ptr nocapture readonly) local_unnamed_addr #0 {
; If we screw up the revisitation of the users of store of %sink above
; we will end up propagating and simplifying this to 1 in the final output
; because we keep an optimistic assumption we should not.
-; CHECK: add i32 %.05160, 1
%37 = add i32 %.05160, 1
%38 = icmp ugt i32 %37, 1
br i1 %38, label %39, label %40
@@ -193,3 +308,20 @@ attributes #5 = { nounwind readonly }
!14 = !{!"long", !3, i64 0}
!15 = !{!11, !2, i64 4}
!16 = !{!11, !2, i64 12}
+;.
+; CHECK: [[TBAA1]] = !{[[META2:![0-9]+]], [[META2]], i64 0}
+; CHECK: [[META2]] = !{!"int", [[META3:![0-9]+]], i64 0}
+; CHECK: [[META3]] = !{!"omnipotent char", [[META4:![0-9]+]], i64 0}
+; CHECK: [[META4]] = !{!"Simple C/C++ TBAA"}
+; CHECK: [[TBAA5]] = !{[[META6:![0-9]+]], [[META6]], i64 0}
+; CHECK: [[META6]] = !{!"any pointer", [[META3]], i64 0}
+; CHECK: [[TBAA7]] = !{[[META8:![0-9]+]], [[META8]], i64 0}
+; CHECK: [[META8]] = !{!"short", [[META3]], i64 0}
+; CHECK: [[TBAA9]] = !{[[META10:![0-9]+]], [[META2]], i64 0}
+; CHECK: [[META10]] = !{!"", [[META2]], i64 0, [[META2]], i64 4, [[META2]], i64 8, [[META2]], i64 12}
+; CHECK: [[TBAA11]] = !{[[META10]], [[META2]], i64 8}
+; CHECK: [[TBAA12]] = !{[[META13:![0-9]+]], [[META13]], i64 0}
+; CHECK: [[META13]] = !{!"long", [[META3]], i64 0}
+; CHECK: [[TBAA14]] = !{[[META10]], [[META2]], i64 4}
+; CHECK: [[TBAA15]] = !{[[META10]], [[META2]], i64 12}
+;.
diff --git a/llvm/test/Transforms/NewGVN/metadata-nonnull.ll b/llvm/test/Transforms/NewGVN/metadata-nonnull.ll
index cd0922f901af4c..5de4c581c051c3 100644
--- a/llvm/test/Transforms/NewGVN/metadata-nonnull.ll
+++ b/llvm/test/Transforms/NewGVN/metadata-nonnull.ll
@@ -150,7 +150,7 @@ define ptr @test7(ptr %v0) {
; CHECK-LABEL: define ptr @test7
; CHECK-SAME: (ptr [[V0:%.*]]) {
; CHECK-NEXT: top:
-; CHECK-NEXT: [[V1:%.*]] = load ptr, ptr [[V0]], align 8, !nonnull !0
+; CHECK-NEXT: [[V1:%.*]] = load ptr, ptr [[V0]], align 8, !nonnull [[META0:![0-9]+]]
; CHECK-NEXT: call void @use2(ptr [[V1]])
; CHECK-NEXT: br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
diff --git a/llvm/test/Transforms/NewGVN/metadata-simplify.ll b/llvm/test/Transforms/NewGVN/metadata-simplify.ll
index a84c581165c3ae..e981e3702d5601 100644
--- a/llvm/test/Transforms/NewGVN/metadata-simplify.ll
+++ b/llvm/test/Transforms/NewGVN/metadata-simplify.ll
@@ -9,11 +9,11 @@ define i1 @test1(ptr %arg, i1 %arg2) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load ptr, ptr [[ARG:%.*]], !nonnull !0
+; CHECK-NEXT: [[LOAD1:%.*]] = load ptr, ptr [[ARG:%.*]], align 8, !nonnull [[META0:![0-9]+]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[LOAD1]], null
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load ptr, ptr [[ARG]]
+; CHECK-NEXT: [[LOAD2:%.*]] = load ptr, ptr [[ARG]], align 8
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq ptr [[LOAD2]], null
; CHECK-NEXT: ret i1 [[CMP2]]
;
@@ -34,11 +34,11 @@ define i1 @test2(ptr %arg, i1 %arg2) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load ptr, ptr [[ARG:%.*]]
+; CHECK-NEXT: [[LOAD1:%.*]] = load ptr, ptr [[ARG:%.*]], align 8
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[LOAD1]], null
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load ptr, ptr [[ARG]], !nonnull !0
+; CHECK-NEXT: [[LOAD2:%.*]] = load ptr, ptr [[ARG]], align 8, !nonnull [[META0]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp eq ptr [[LOAD2]], null
; CHECK-NEXT: ret i1 [[CMP2]]
;
@@ -60,11 +60,11 @@ define i1 @test3(ptr %ptr, i1 %arg2) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], !range !1
+; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], align 4, !range [[RNG1:![0-9]+]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]]
+; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], align 4
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
@@ -85,11 +85,11 @@ define i1 @test4(ptr %ptr, i1 %arg2) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]]
+; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], !range !1
+; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], align 4, !range [[RNG1]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
@@ -110,11 +110,11 @@ define i1 @test5(ptr %ptr, i1 %arg2) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], !range !1
+; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], align 4, !range [[RNG1]]
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]]
+; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], align 4
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
@@ -135,11 +135,11 @@ define i1 @test6(ptr %ptr, i1 %arg2) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]]
+; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[PTR:%.*]], align 4
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT: ret i1 [[CMP1]]
; CHECK: bb2:
-; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], !range !1
+; CHECK-NEXT: [[LOAD2:%.*]] = load i32, ptr [[PTR]], align 4, !range [[RNG1]]
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT: ret i1 [[CMP2]]
;
diff --git a/llvm/test/Transforms/NewGVN/noalias.ll b/llvm/test/Transforms/NewGVN/noalias.ll
index 5f0c5dd8a3aeaf..2cb5c196a7abf7 100644
--- a/llvm/test/Transforms/NewGVN/noalias.ll
+++ b/llvm/test/Transforms/NewGVN/noalias.ll
@@ -1,10 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
define i32 @test1(ptr %p, ptr %q) {
-; CHECK-LABEL: @test1(ptr %p, ptr %q)
-; CHECK: load i32, ptr %p
-; CHECK-NOT: noalias
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test1(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = load i32, ptr %p, !noalias !3
%b = load i32, ptr %p
%c = add i32 %a, %b
@@ -12,9 +15,12 @@ define i32 @test1(ptr %p, ptr %q) {
}
define i32 @test2(ptr %p, ptr %q) {
-; CHECK-LABEL: @test2(ptr %p, ptr %q)
-; CHECK: load i32, ptr %p, align 4, !alias.scope ![[SCOPE1:[0-9]+]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test2(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !alias.scope [[META0:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = load i32, ptr %p, !alias.scope !3
%b = load i32, ptr %p, !alias.scope !3
%c = add i32 %a, %b
@@ -22,17 +28,18 @@ define i32 @test2(ptr %p, ptr %q) {
}
define i32 @test3(ptr %p, ptr %q) {
-; CHECK-LABEL: @test3(ptr %p, ptr %q)
-; CHECK: load i32, ptr %p, align 4, !alias.scope ![[SCOPE2:[0-9]+]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test3(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !alias.scope [[META3:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = load i32, ptr %p, !alias.scope !4
%b = load i32, ptr %p, !alias.scope !5
%c = add i32 %a, %b
ret i32 %c
}
-; CHECK: ![[SCOPE1]] = !{!{{[0-9]+}}}
-; CHECK: ![[SCOPE2]] = !{!{{[0-9]+}}, !{{[0-9]+}}}
declare i32 @foo(ptr) readonly
!0 = distinct !{!0, !2, !"callee0: %a"}
@@ -42,3 +49,10 @@ declare i32 @foo(ptr) readonly
!3 = !{!0}
!4 = !{!1}
!5 = !{!0, !1}
+;.
+; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
+; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]], !"callee0: %a"}
+; CHECK: [[META2]] = distinct !{[[META2]], !"callee0"}
+; CHECK: [[META3]] = !{[[META4:![0-9]+]], [[META1]]}
+; CHECK: [[META4]] = distinct !{[[META4]], [[META2]], !"callee0: %b"}
+;.
diff --git a/llvm/test/Transforms/NewGVN/nomemlocation.ll b/llvm/test/Transforms/NewGVN/nomemlocation.ll
index 0f716b30801b25..332e6c6304c315 100644
--- a/llvm/test/Transforms/NewGVN/nomemlocation.ll
+++ b/llvm/test/Transforms/NewGVN/nomemlocation.ll
@@ -1,8 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -S -p='newgvn' | FileCheck %s
; MemorySSA should be able to handle a clobber query with an empty MemoryLocation.
-; CHECK: @userread
define ptr @userread(ptr %p) {
+; CHECK-LABEL: define ptr @userread(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[POS:%.*]] = phi i64 [ 1, [[ENTRY:%.*]] ], [ [[DIFF:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[POS]]
+; CHECK-NEXT: [[LD:%.*]] = load ptr, ptr [[GEP]], align 8
+; CHECK-NEXT: [[READVAL:%.*]] = call i64 @fread(ptr noundef nonnull [[GEP]], i64 noundef 1, i64 noundef [[POS]], ptr noundef [[LD]])
+; CHECK-NEXT: [[READVALISPOS:%.*]] = icmp eq i64 [[READVAL]], [[POS]]
+; CHECK-NEXT: call void @llvm.assume(i1 [[READVALISPOS]])
+; CHECK-NEXT: [[DIFF]] = sub i64 0, [[POS]]
+; CHECK-NEXT: br label [[LOOP]]
+;
entry:
br label %loop
diff --git a/llvm/test/Transforms/NewGVN/non-integral-pointers.ll b/llvm/test/Transforms/NewGVN/non-integral-pointers.ll
index 6119577d3b2422..1e3da6e295d16b 100644
--- a/llvm/test/Transforms/NewGVN/non-integral-pointers.ll
+++ b/llvm/test/Transforms/NewGVN/non-integral-pointers.ll
@@ -1,37 +1,55 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:4"
target triple = "x86_64-unknown-linux-gnu"
define void @f0(i1 %alwaysFalse, i64 %val, ptr %loc) {
-; CHECK-LABEL: @f0(
-; CHECK-NOT: inttoptr
-; CHECK-NOT: ptrtoint
- entry:
+; CHECK-LABEL: define void @f0(
+; CHECK-SAME: i1 [[ALWAYSFALSE:%.*]], i64 [[VAL:%.*]], ptr [[LOC:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store i64 [[VAL]], ptr [[LOC]], align 8
+; CHECK-NEXT: br i1 [[ALWAYSFALSE]], label [[NEVERTAKEN:%.*]], label [[ALWAYSTAKEN:%.*]]
+; CHECK: neverTaken:
+; CHECK-NEXT: [[PTR:%.*]] = load ptr addrspace(4), ptr [[LOC]], align 8
+; CHECK-NEXT: store i8 5, ptr addrspace(4) [[PTR]], align 1
+; CHECK-NEXT: ret void
+; CHECK: alwaysTaken:
+; CHECK-NEXT: ret void
+;
+ entry:
store i64 %val, ptr %loc
br i1 %alwaysFalse, label %neverTaken, label %alwaysTaken
- neverTaken:
+ neverTaken:
%ptr = load ptr addrspace(4), ptr %loc
store i8 5, ptr addrspace(4) %ptr
ret void
- alwaysTaken:
+ alwaysTaken:
ret void
}
define i64 @f1(i1 %alwaysFalse, ptr addrspace(4) %val, ptr %loc) {
-; CHECK-LABEL: @f1(
-; CHECK-NOT: inttoptr
-; CHECK-NOT: ptrtoint
- entry:
+; CHECK-LABEL: define i64 @f1(
+; CHECK-SAME: i1 [[ALWAYSFALSE:%.*]], ptr addrspace(4) [[VAL:%.*]], ptr [[LOC:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store ptr addrspace(4) [[VAL]], ptr [[LOC]], align 8
+; CHECK-NEXT: br i1 [[ALWAYSFALSE]], label [[NEVERTAKEN:%.*]], label [[ALWAYSTAKEN:%.*]]
+; CHECK: neverTaken:
+; CHECK-NEXT: [[INT:%.*]] = load i64, ptr [[LOC]], align 8
+; CHECK-NEXT: ret i64 [[INT]]
+; CHECK: alwaysTaken:
+; CHECK-NEXT: ret i64 42
+;
+ entry:
store ptr addrspace(4) %val, ptr %loc
br i1 %alwaysFalse, label %neverTaken, label %alwaysTaken
- neverTaken:
+ neverTaken:
%int = load i64, ptr %loc
ret i64 %int
- alwaysTaken:
+ alwaysTaken:
ret i64 42
}
diff --git a/llvm/test/Transforms/NewGVN/null-aliases-nothing.ll b/llvm/test/Transforms/NewGVN/null-aliases-nothing.ll
index 666621119d4cb4..25295fac7400d9 100644
--- a/llvm/test/Transforms/NewGVN/null-aliases-nothing.ll
+++ b/llvm/test/Transforms/NewGVN/null-aliases-nothing.ll
@@ -1,19 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
%t = type { i32 }
declare void @test1f(ptr)
define void @test1(ptr noalias %stuff ) {
- %before = load i32, ptr %stuff
+; CHECK-LABEL: define void @test1(
+; CHECK-SAME: ptr noalias [[STUFF:%.*]]) {
+; CHECK-NEXT: [[BEFORE:%.*]] = load i32, ptr [[STUFF]], align 4
+; CHECK-NEXT: call void @test1f(ptr null)
+; CHECK-NEXT: [[SUM:%.*]] = add i32 [[BEFORE]], [[BEFORE]]
+; CHECK-NEXT: store i32 [[SUM]], ptr [[STUFF]], align 4
+; CHECK-NEXT: ret void
+;
+ %before = load i32, ptr %stuff
- call void @test1f(ptr null)
+ call void @test1f(ptr null)
- %after = load i32, ptr %stuff ; <--- This should be a dead load
- %sum = add i32 %before, %after
+ %after = load i32, ptr %stuff ; <--- This should be a dead load
+ %sum = add i32 %before, %after
- store i32 %sum, ptr %stuff
- ret void
-; CHECK: load
-; CHECK-NOT: load
-; CHECK: ret void
+ store i32 %sum, ptr %stuff
+ ret void
}
diff --git a/llvm/test/Transforms/NewGVN/phi-edge-handling.ll b/llvm/test/Transforms/NewGVN/phi-edge-handling.ll
index 8dfac7942210ce..0e871b6b261a43 100644
--- a/llvm/test/Transforms/NewGVN/phi-edge-handling.ll
+++ b/llvm/test/Transforms/NewGVN/phi-edge-handling.ll
@@ -9,8 +9,8 @@ define i16 @hoge() {
; CHECK-LABEL: @hoge(
; CHECK-NEXT: bb:
; CHECK-NEXT: switch i8 undef, label [[BB7:%.*]] [
-; CHECK-NEXT: i8 0, label [[BB1:%.*]]
-; CHECK-NEXT: i8 12, label [[BB2:%.*]]
+; CHECK-NEXT: i8 0, label [[BB1:%.*]]
+; CHECK-NEXT: i8 12, label [[BB2:%.*]]
; CHECK-NEXT: ]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB6:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/phi-of-ops-simplified-to-existing-value-then-changes-again.ll b/llvm/test/Transforms/NewGVN/phi-of-ops-simplified-to-existing-value-then-changes-again.ll
index ac07148c75521f..573a4c0bd0bcb1 100644
--- a/llvm/test/Transforms/NewGVN/phi-of-ops-simplified-to-existing-value-then-changes-again.ll
+++ b/llvm/test/Transforms/NewGVN/phi-of-ops-simplified-to-existing-value-then-changes-again.ll
@@ -88,8 +88,8 @@ define void @pr42422(i1 %c.1, i1 %c.2) {
; CHECK: bb16:
; CHECK-NEXT: [[TMP17:%.*]] = phi i32 [ poison, [[BB15]] ], [ 1, [[BB14]] ], [ 9, [[BB7]] ]
; CHECK-NEXT: switch i32 [[TMP17]], label [[BB19]] [
-; CHECK-NEXT: i32 0, label [[BB6]]
-; CHECK-NEXT: i32 9, label [[BB18:%.*]]
+; CHECK-NEXT: i32 0, label [[BB6]]
+; CHECK-NEXT: i32 9, label [[BB18:%.*]]
; CHECK-NEXT: ]
; CHECK: bb18:
; CHECK-NEXT: br label [[BB19]]
diff --git a/llvm/test/Transforms/NewGVN/phi-translate-partial-alias.ll b/llvm/test/Transforms/NewGVN/phi-translate-partial-alias.ll
index cb24b050a599e3..7dd41904970c07 100644
--- a/llvm/test/Transforms/NewGVN/phi-translate-partial-alias.ll
+++ b/llvm/test/Transforms/NewGVN/phi-translate-partial-alias.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64"
@@ -6,12 +7,19 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; not actually redundant around the loop backedge, despite appearances
; if phi-translation is ignored.
-; CHECK: define void @test0(ptr %begin)
-; CHECK: loop:
-; CHECK: %l0 = load i8, ptr %phi
-; CHECK: call void @bar(i8 %l0)
-; CHECK: %l1 = load i8, ptr %phi
define void @test0(ptr %begin) {
+; CHECK-LABEL: define void @test0(
+; CHECK-SAME: ptr [[BEGIN:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[PHI:%.*]] = phi ptr [ [[BEGIN]], [[ENTRY:%.*]] ], [ [[NEXT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[L0:%.*]] = load i8, ptr [[PHI]], align 1
+; CHECK-NEXT: call void @bar(i8 [[L0]])
+; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[PHI]], align 1
+; CHECK-NEXT: [[NEXT]] = getelementptr inbounds i8, ptr [[PHI]], i8 [[L1]]
+; CHECK-NEXT: br label [[LOOP]]
+;
entry:
br label %loop
diff --git a/llvm/test/Transforms/NewGVN/pr17732.ll b/llvm/test/Transforms/NewGVN/pr17732.ll
index 427543d3aae7a7..e66547cb9e1933 100644
--- a/llvm/test/Transforms/NewGVN/pr17732.ll
+++ b/llvm/test/Transforms/NewGVN/pr17732.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S -o - < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -12,6 +13,12 @@ target triple = "x86_64-unknown-linux-gnu"
@vector_with_zeroinit = common global %struct.with_vector zeroinitializer, align 4
define i32 @main() {
+; CHECK-LABEL: define i32 @main() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 @array_with_zeroinit, ptr align 4 @main.obj_with_array, i64 12, i1 false)
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 @vector_with_zeroinit, ptr align 4 @main.obj_with_vector, i64 12, i1 false)
+; CHECK-NEXT: ret i32 1
+;
entry:
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 @array_with_zeroinit, ptr align 4 @main.obj_with_array, i64 12, i1 false)
%0 = load i8, ptr getelementptr inbounds (%struct.with_array, ptr @array_with_zeroinit, i64 0, i32 2), align 4
@@ -22,8 +29,6 @@ entry:
%conv1 = sext i8 %1 to i32
%and = and i32 %conv0, %conv1
ret i32 %and
-; CHECK-LABEL: define i32 @main(
-; CHECK: ret i32 1
}
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
diff --git a/llvm/test/Transforms/NewGVN/pr17852.ll b/llvm/test/Transforms/NewGVN/pr17852.ll
index 5858982ce1cd85..bffde124164448 100644
--- a/llvm/test/Transforms/NewGVN/pr17852.ll
+++ b/llvm/test/Transforms/NewGVN/pr17852.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
%struct.S0 = type { [2 x i8], [2 x i8], [4 x i8], [2 x i8], i32, i32, i32, i32 }
diff --git a/llvm/test/Transforms/NewGVN/pr24397.ll b/llvm/test/Transforms/NewGVN/pr24397.ll
index f3f112ae1fe319..d9981443522e7f 100644
--- a/llvm/test/Transforms/NewGVN/pr24397.ll
+++ b/llvm/test/Transforms/NewGVN/pr24397.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -disable-output < %s
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/NewGVN/pr24426.ll b/llvm/test/Transforms/NewGVN/pr24426.ll
index e8a88f5b267ab6..8f0974aa0bd356 100644
--- a/llvm/test/Transforms/NewGVN/pr24426.ll
+++ b/llvm/test/Transforms/NewGVN/pr24426.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=memcpyopt,mldst-motion,newgvn -S | FileCheck %s
declare void @check(i8)
@@ -5,11 +6,17 @@ declare void @check(i8)
declare void @write(ptr %res)
define void @test1() {
+; CHECK-LABEL: define void @test1() {
+; CHECK-NEXT: [[TMP1:%.*]] = alloca [10 x i8], align 1
+; CHECK-NEXT: call void @write(ptr [[TMP1]])
+; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP1]], align 1
+; CHECK-NEXT: call void @check(i8 [[TMP2]])
+; CHECK-NEXT: ret void
+;
%1 = alloca [10 x i8]
call void @write(ptr %1)
%2 = load i8, ptr %1
-; CHECK-NOT: undef
call void @check(i8 %2)
ret void
diff --git a/llvm/test/Transforms/NewGVN/pr25440.ll b/llvm/test/Transforms/NewGVN/pr25440.ll
index b3ebf447afc2e5..9d9c4cda342581 100644
--- a/llvm/test/Transforms/NewGVN/pr25440.ll
+++ b/llvm/test/Transforms/NewGVN/pr25440.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
;RUN: opt -passes=newgvn -S < %s | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n8:16:32-S64"
@@ -10,19 +11,51 @@ target triple = "thumbv7--linux-gnueabi"
; Function Attrs: nounwind
define fastcc void @foo(ptr nocapture readonly %x) {
-;CHECK-LABEL: foo
+; CHECK-LABEL: define fastcc void @foo(
+; CHECK-SAME: ptr nocapture readonly [[X:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[BB0:%.*]]
+; CHECK: bb0:
+; CHECK-NEXT: [[X_TR:%.*]] = phi ptr [ [[X]], [[ENTRY:%.*]] ], [ null, [[LAND_LHS_TRUE:%.*]] ]
+; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[X_TR]], align 4
+; CHECK-NEXT: [[CONV:%.*]] = zext i16 [[TMP0]] to i32
+; CHECK-NEXT: switch i32 [[CONV]], label [[IF_END_50:%.*]] [
+; CHECK-NEXT: i32 43, label [[CLEANUP:%.*]]
+; CHECK-NEXT: i32 52, label [[IF_THEN_5:%.*]]
+; CHECK-NEXT: ]
+; CHECK: if.then.5:
+; CHECK-NEXT: br i1 undef, label [[LAND_LHS_TRUE]], label [[IF_THEN_26:%.*]]
+; CHECK: land.lhs.true:
+; CHECK-NEXT: br i1 undef, label [[CLEANUP]], label [[BB0]]
+; CHECK: if.then.26:
+; CHECK-NEXT: br i1 undef, label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
+; CHECK: cond.false:
+; CHECK-NEXT: [[MODE:%.*]] = getelementptr inbounds [[STRUCT_A:%.*]], ptr [[X_TR]], i32 0, i32 1
+; CHECK-NEXT: [[BF_LOAD:%.*]] = load i16, ptr [[MODE]], align 2
+; CHECK-NEXT: br label [[COND_END]]
+; CHECK: cond.end:
+; CHECK-NEXT: br i1 undef, label [[IF_THEN_44:%.*]], label [[CLEANUP]]
+; CHECK: if.then.44:
+; CHECK-NEXT: unreachable
+; CHECK: if.end.50:
+; CHECK-NEXT: [[ARRAYIDX52:%.*]] = getelementptr inbounds [0 x i32], ptr @length, i32 0, i32 [[CONV]]
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX52]], align 4
+; CHECK-NEXT: br i1 undef, label [[FOR_BODY_57:%.*]], label [[CLEANUP]]
+; CHECK: for.body.57:
+; CHECK-NEXT: unreachable
+; CHECK: cleanup:
+; CHECK-NEXT: ret void
+;
entry:
br label %bb0
bb0: ; preds = %land.lhs.true, %entry
-;CHECK: bb0:
%x.tr = phi ptr [ %x, %entry ], [ null, %land.lhs.true ]
%0 = load i16, ptr %x.tr, align 4
-; CHECK: load i16, ptr
%conv = zext i16 %0 to i32
switch i32 %conv, label %if.end.50 [
- i32 43, label %cleanup
- i32 52, label %if.then.5
+ i32 43, label %cleanup
+ i32 52, label %if.then.5
]
if.then.5: ; preds = %bb0
@@ -36,8 +69,6 @@ if.then.26: ; preds = %if.then.5
br i1 undef, label %cond.end, label %cond.false
cond.false: ; preds = %if.then.26
-; CHECK: cond.false:
-; CHECK: load i16
%mode = getelementptr inbounds %struct.a, ptr %x.tr.lcssa163, i32 0, i32 1
%bf.load = load i16, ptr %mode, align 2
%bf.shl = shl i16 %bf.load, 8
@@ -50,7 +81,6 @@ if.then.44: ; preds = %cond.end
unreachable
if.end.50: ; preds = %bb0
-;%CHECK: if.end.50:
%conv.lcssa = phi i32 [ %conv, %bb0 ]
%arrayidx52 = getelementptr inbounds [0 x i32], ptr @length, i32 0, i32 %conv.lcssa
%1 = load i32, ptr %arrayidx52, align 4
@@ -68,7 +98,34 @@ cleanup: ; preds = %if.end.50, %cond.en
@dfg_text = external global ptr, align 4
define void @dfg_lex() {
-;CHECK-LABEL: dfg_lex
+; CHECK-LABEL: define void @dfg_lex() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[WHILE_BODYTHREAD_PRE_SPLIT:%.*]]
+; CHECK: while.bodythread-pre-split:
+; CHECK-NEXT: br i1 undef, label [[IF_THEN_14:%.*]], label [[IF_END_15:%.*]]
+; CHECK: if.then.14:
+; CHECK-NEXT: [[V1:%.*]] = load i32, ptr @dfg_text, align 4
+; CHECK-NEXT: br label [[IF_END_15]]
+; CHECK: if.end.15:
+; CHECK-NEXT: [[V2:%.*]] = load ptr, ptr @yy_c_buf_p, align 4
+; CHECK-NEXT: br label [[WHILE_COND_16:%.*]]
+; CHECK: while.cond.16:
+; CHECK-NEXT: br i1 undef, label [[WHILE_COND_16]], label [[WHILE_END:%.*]]
+; CHECK: while.end:
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, ptr [[V2]], i32 undef
+; CHECK-NEXT: store ptr [[ADD_PTR]], ptr @dfg_text, align 4
+; CHECK-NEXT: [[SUB_PTR_RHS_CAST25:%.*]] = ptrtoint ptr [[ADD_PTR]] to i32
+; CHECK-NEXT: switch i32 undef, label [[SW_DEFAULT:%.*]] [
+; CHECK-NEXT: i32 65, label [[WHILE_BODYTHREAD_PRE_SPLIT]]
+; CHECK-NEXT: i32 3, label [[RETURN:%.*]]
+; CHECK-NEXT: i32 57, label [[WHILE_BODYTHREAD_PRE_SPLIT]]
+; CHECK-NEXT: i32 60, label [[IF_THEN_14]]
+; CHECK-NEXT: ]
+; CHECK: sw.default:
+; CHECK-NEXT: unreachable
+; CHECK: return:
+; CHECK-NEXT: ret void
+;
entry:
br label %while.bodythread-pre-split
@@ -93,10 +150,10 @@ while.end: ; preds = %while.cond.16
%sub.ptr.rhs.cast25 = ptrtoint ptr %add.ptr to i32
%sub.ptr.sub26 = sub i32 0, %sub.ptr.rhs.cast25
switch i32 undef, label %sw.default [
- i32 65, label %while.bodythread-pre-split
- i32 3, label %return
- i32 57, label %while.bodythread-pre-split
- i32 60, label %if.then.14
+ i32 65, label %while.bodythread-pre-split
+ i32 3, label %return
+ i32 57, label %while.bodythread-pre-split
+ i32 60, label %if.then.14
]
sw.default: ; preds = %while.end
diff --git a/llvm/test/Transforms/NewGVN/pr28562.ll b/llvm/test/Transforms/NewGVN/pr28562.ll
index a62fdd31da7210..320224c24b5bc0 100644
--- a/llvm/test/Transforms/NewGVN/pr28562.ll
+++ b/llvm/test/Transforms/NewGVN/pr28562.ll
@@ -1,9 +1,12 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn < %s | FileCheck %s
define ptr @test1(ptr %a) {
+; CHECK-LABEL: define ptr @test1(
+; CHECK-SAME: ptr [[A:%.*]]) {
+; CHECK-NEXT: [[X2:%.*]] = getelementptr i32, ptr [[A]], i32 10
+; CHECK-NEXT: ret ptr [[X2]]
+;
%x1 = getelementptr inbounds i32, ptr %a, i32 10
%x2 = getelementptr i32, ptr %a, i32 10
ret ptr %x2
-; CHECK-LABEL: @test1(
-; CHECK: %[[x:.*]] = getelementptr i32, ptr %a, i32 10
-; CHECK: ret ptr %[[x]]
}
diff --git a/llvm/test/Transforms/NewGVN/pr31472.ll b/llvm/test/Transforms/NewGVN/pr31472.ll
index 8bb9a14e813653..8eeb61400f8141 100644
--- a/llvm/test/Transforms/NewGVN/pr31472.ll
+++ b/llvm/test/Transforms/NewGVN/pr31472.ll
@@ -9,11 +9,13 @@ target triple = "x86_64-apple-macosx10.12.0"
define i32 @main() personality ptr @__gxx_personality_v0{
; CHECK-LABEL: @main(
; CHECK-NEXT: [[TMP1:%.*]] = invoke i32 @foo()
-; CHECK-NEXT: to label %good unwind label %bad
+; CHECK-NEXT: to label [[GOOD:%.*]] unwind label [[BAD:%.*]]
; CHECK: good:
; CHECK-NEXT: ret i32 5
; CHECK: bad:
-; CHECK-NEXT: [[TMP2:%.*]] = landingpad { ptr, i32
+; CHECK-NEXT: [[TMP2:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: resume { ptr, i32 } [[TMP2]]
;
%1 = invoke i32 @foo()
to label %good unwind label %bad
diff --git a/llvm/test/Transforms/NewGVN/pr31483.ll b/llvm/test/Transforms/NewGVN/pr31483.ll
index fe957dec72cf12..0e7461c2612b9f 100644
--- a/llvm/test/Transforms/NewGVN/pr31483.ll
+++ b/llvm/test/Transforms/NewGVN/pr31483.ll
@@ -10,20 +10,20 @@ define signext i32 @ham(ptr %arg, ptr %arg1) #0 {
; CHECK-LABEL: @ham(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[TMP:%.*]] = alloca ptr, align 8
-; CHECK-NEXT: store ptr %arg1, ptr [[TMP]], align 8
-; CHECK-NEXT: br label %bb2
+; CHECK-NEXT: store ptr [[ARG1:%.*]], ptr [[TMP]], align 8
+; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: [[TMP3:%.*]] = phi ptr [ %arg, %bb ], [ %tmp7, %bb22 ]
+; CHECK-NEXT: [[TMP3:%.*]] = phi ptr [ [[ARG:%.*]], [[BB:%.*]] ], [ [[TMP7:%.*]], [[BB22:%.*]] ]
; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[TMP3]], align 1
; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i8 [[TMP4]], 0
-; CHECK-NEXT: br i1 [[TMP5]], label %bb6, label %bb23
+; CHECK-NEXT: br i1 [[TMP5]], label [[BB6:%.*]], label [[BB23:%.*]]
; CHECK: bb6:
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i32 1
+; CHECK-NEXT: [[TMP7]] = getelementptr inbounds i8, ptr [[TMP3]], i32 1
; CHECK-NEXT: [[TMP9:%.*]] = zext i8 [[TMP4]] to i32
-; CHECK-NEXT: switch i32 [[TMP9]], label %bb22 [
-; CHECK-NEXT: i32 115, label %bb10
-; CHECK-NEXT: i32 105, label %bb16
-; CHECK-NEXT: i32 99, label %bb16
+; CHECK-NEXT: switch i32 [[TMP9]], label [[BB22]] [
+; CHECK-NEXT: i32 115, label [[BB10:%.*]]
+; CHECK-NEXT: i32 105, label [[BB16:%.*]]
+; CHECK-NEXT: i32 99, label [[BB16]]
; CHECK-NEXT: ]
; CHECK: bb10:
; CHECK-NEXT: [[TMP11:%.*]] = load ptr, ptr [[TMP]], align 8
@@ -31,15 +31,15 @@ define signext i32 @ham(ptr %arg, ptr %arg1) #0 {
; CHECK-NEXT: store ptr [[TMP12]], ptr [[TMP]], align 8
; CHECK-NEXT: [[TMP14:%.*]] = load ptr, ptr [[TMP11]], align 8
; CHECK-NEXT: [[TMP15:%.*]] = call signext i32 (ptr, ...) @zot(ptr @global, ptr [[TMP14]])
-; CHECK-NEXT: br label %bb22
+; CHECK-NEXT: br label [[BB22]]
; CHECK: bb16:
; CHECK-NEXT: [[TMP17:%.*]] = load ptr, ptr [[TMP]], align 8
; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[TMP17]], i64 8
; CHECK-NEXT: store ptr [[TMP18]], ptr [[TMP]], align 8
; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[TMP17]], i64 4
-; CHECK-NEXT: br label %bb22
+; CHECK-NEXT: br label [[BB22]]
; CHECK: bb22:
-; CHECK-NEXT: br label %bb2
+; CHECK-NEXT: br label [[BB2]]
; CHECK: bb23:
; CHECK-NEXT: call void @llvm.va_end(ptr [[TMP]])
; CHECK-NEXT: ret i32 undef
diff --git a/llvm/test/Transforms/NewGVN/pr31491.ll b/llvm/test/Transforms/NewGVN/pr31491.ll
index 5f6b371333bbf0..f27f13ed24e08a 100644
--- a/llvm/test/Transforms/NewGVN/pr31491.ll
+++ b/llvm/test/Transforms/NewGVN/pr31491.ll
@@ -7,13 +7,13 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define internal i32 @pr31491() {
; CHECK-LABEL: @pr31491(
; CHECK-NEXT: bb5:
-; CHECK-NEXT: br label %bb7
+; CHECK-NEXT: br label [[BB7:%.*]]
; CHECK: bb7:
-; CHECK-NEXT: [[TMP:%.*]] = phi ptr [ [[TMP:%.*]]11, %bb10 ], [ undef, %bb5 ]
-; CHECK-NEXT: br label %bb10
+; CHECK-NEXT: [[TMP:%.*]] = phi ptr [ [[TMP11:%.*]], [[BB10:%.*]] ], [ undef, [[BB5:%.*]] ]
+; CHECK-NEXT: br label [[BB10]]
; CHECK: bb10:
-; CHECK-NEXT: [[TMP11:%.*]] = tail call ptr @patatino(ptr [[TMP]])
-; CHECK-NEXT: br label %bb7
+; CHECK-NEXT: [[TMP11]] = tail call ptr @patatino(ptr [[TMP]])
+; CHECK-NEXT: br label [[BB7]]
;
bb5:
br label %bb7
diff --git a/llvm/test/Transforms/NewGVN/pr31501.ll b/llvm/test/Transforms/NewGVN/pr31501.ll
index 55195fd6ada764..18bfcd1b9ca09c 100644
--- a/llvm/test/Transforms/NewGVN/pr31501.ll
+++ b/llvm/test/Transforms/NewGVN/pr31501.ll
@@ -52,30 +52,30 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define weak_odr hidden ptr @quux(ptr %arg, ptr %arg1) local_unnamed_addr #0 align 2 {
; CHECK-LABEL: @quux(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds %struct.barney, ptr %arg, i64 0, i32 3, i32 0, i32 0, i32 0
-; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP]], align 8, !tbaa !2
-; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds %struct.barney, ptr %arg, i64 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 1
-; CHECK-NEXT: [[TMP6:%.*]] = load ptr, ptr [[TMP4]], align 8, !tbaa !7
+; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[STRUCT_BARNEY:%.*]], ptr [[ARG:%.*]], i64 0, i32 3, i32 0, i32 0, i32 0
+; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP]], align 8, !tbaa [[TBAA2:![0-9]+]]
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_BARNEY]], ptr [[ARG]], i64 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 1
+; CHECK-NEXT: [[TMP6:%.*]] = load ptr, ptr [[TMP4]], align 8, !tbaa [[TBAA7:![0-9]+]]
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq ptr [[TMP3]], [[TMP6]]
-; CHECK-NEXT: br i1 [[TMP7]], label %bb21, label %bb8
+; CHECK-NEXT: br i1 [[TMP7]], label [[BB21:%.*]], label [[BB8:%.*]]
; CHECK: bb8:
-; CHECK-NEXT: br label %bb11
+; CHECK-NEXT: br label [[BB11:%.*]]
; CHECK: bb9:
; CHECK-NEXT: [[TMP10:%.*]] = icmp eq ptr [[TMP18:%.*]], [[TMP6]]
-; CHECK-NEXT: br i1 [[TMP10]], label %bb19, label %bb11
+; CHECK-NEXT: br i1 [[TMP10]], label [[BB19:%.*]], label [[BB11]]
; CHECK: bb11:
-; CHECK-NEXT: [[TMP12:%.*]] = phi ptr [ [[TMP17:%.*]], %bb9 ], [ undef, %bb8 ]
-; CHECK-NEXT: [[TMP13:%.*]] = phi ptr [ [[TMP18]], %bb9 ], [ [[TMP3]], %bb8 ]
-; CHECK-NEXT: [[TMP15:%.*]] = load ptr, ptr [[TMP13]], align 8, !tbaa !8
-; CHECK-NEXT: [[TMP16:%.*]] = icmp eq ptr [[TMP15]], %arg1
+; CHECK-NEXT: [[TMP12:%.*]] = phi ptr [ [[TMP17:%.*]], [[BB9:%.*]] ], [ undef, [[BB8]] ]
+; CHECK-NEXT: [[TMP13:%.*]] = phi ptr [ [[TMP18]], [[BB9]] ], [ [[TMP3]], [[BB8]] ]
+; CHECK-NEXT: [[TMP15:%.*]] = load ptr, ptr [[TMP13]], align 8, !tbaa [[TBAA8:![0-9]+]]
+; CHECK-NEXT: [[TMP16:%.*]] = icmp eq ptr [[TMP15]], [[ARG1:%.*]]
; CHECK-NEXT: [[TMP17]] = select i1 [[TMP16]], ptr [[TMP13]], ptr [[TMP12]]
-; CHECK-NEXT: [[TMP18]] = getelementptr inbounds %struct.foo, ptr [[TMP13]], i64 1
-; CHECK-NEXT: br i1 [[TMP16]], label %bb19, label %bb9
+; CHECK-NEXT: [[TMP18]] = getelementptr inbounds [[STRUCT_FOO:%.*]], ptr [[TMP13]], i64 1
+; CHECK-NEXT: br i1 [[TMP16]], label [[BB19]], label [[BB9]]
; CHECK: bb19:
-; CHECK-NEXT: [[TMP20:%.*]] = phi ptr [ null, %bb9 ], [ [[TMP17]], %bb11 ]
-; CHECK-NEXT: br label %bb21
+; CHECK-NEXT: [[TMP20:%.*]] = phi ptr [ null, [[BB9]] ], [ [[TMP17]], [[BB11]] ]
+; CHECK-NEXT: br label [[BB21]]
; CHECK: bb21:
-; CHECK-NEXT: [[TMP22:%.*]] = phi ptr [ null, %bb ], [ [[TMP20]], %bb19 ]
+; CHECK-NEXT: [[TMP22:%.*]] = phi ptr [ null, [[BB:%.*]] ], [ [[TMP20]], [[BB19]] ]
; CHECK-NEXT: ret ptr [[TMP22]]
;
bb:
diff --git a/llvm/test/Transforms/NewGVN/pr31573.ll b/llvm/test/Transforms/NewGVN/pr31573.ll
index 2382c487c19af0..7835e9d45a6713 100644
--- a/llvm/test/Transforms/NewGVN/pr31573.ll
+++ b/llvm/test/Transforms/NewGVN/pr31573.ll
@@ -10,7 +10,7 @@ define void @patatino(ptr %blah) {
; CHECK: while.cond:
; CHECK-NEXT: [[MEH:%.*]] = phi ptr [ [[BLAH:%.*]], [[ENTRY:%.*]] ], [ null, [[WHILE_BODY:%.*]] ]
; CHECK-NEXT: switch i32 undef, label [[WHILE_BODY]] [
-; CHECK-NEXT: i32 666, label [[WHILE_END:%.*]]
+; CHECK-NEXT: i32 666, label [[WHILE_END:%.*]]
; CHECK-NEXT: ]
; CHECK: while.body:
; CHECK-NEXT: br label [[WHILE_COND]]
diff --git a/llvm/test/Transforms/NewGVN/pr31594.ll b/llvm/test/Transforms/NewGVN/pr31594.ll
index 47294d5640e468..d1a02d62934dee 100644
--- a/llvm/test/Transforms/NewGVN/pr31594.ll
+++ b/llvm/test/Transforms/NewGVN/pr31594.ll
@@ -10,8 +10,8 @@ define i1 @patatino(ptr %blah, i32 %choice) {
; CHECK: while.cond:
; CHECK-NEXT: [[FOO:%.*]] = phi ptr [ [[BLAH:%.*]], [[ENTRY:%.*]] ], [ null, [[WHILE_BODY:%.*]] ]
; CHECK-NEXT: switch i32 [[CHOICE:%.*]], label [[WHILE_BODY]] [
-; CHECK-NEXT: i32 -1, label [[WHILE_END:%.*]]
-; CHECK-NEXT: i32 40, label [[LAND_END:%.*]]
+; CHECK-NEXT: i32 -1, label [[WHILE_END:%.*]]
+; CHECK-NEXT: i32 40, label [[LAND_END:%.*]]
; CHECK-NEXT: ]
; CHECK: land.end:
; CHECK-NEXT: br label [[WHILE_END]]
@@ -66,7 +66,7 @@ define void @foo(ptr %arg) {
; CHECK: bb2:
; CHECK-NEXT: br label [[BB1]]
; CHECK: bb3:
-; CHECK-NEXT: store i8 0, ptr [[TMP]], align 1, !g !0
+; CHECK-NEXT: store i8 0, ptr [[TMP]], align 1, !g [[META0:![0-9]+]]
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb4:
; CHECK-NEXT: br label [[BB6:%.*]]
@@ -74,13 +74,13 @@ define void @foo(ptr %arg) {
; CHECK-NEXT: br i1 undef, label [[BB9:%.*]], label [[BB7:%.*]]
; CHECK: bb7:
; CHECK-NEXT: switch i8 0, label [[BB6]] [
-; CHECK-NEXT: i8 6, label [[BB8:%.*]]
+; CHECK-NEXT: i8 6, label [[BB8:%.*]]
; CHECK-NEXT: ]
; CHECK: bb8:
; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[BB4]]
; CHECK: bb9:
-; CHECK-NEXT: store i8 0, ptr [[ARG]], align 1, !g !0
+; CHECK-NEXT: store i8 0, ptr [[ARG]], align 1, !g [[META0]]
; CHECK-NEXT: unreachable
;
bb:
diff --git a/llvm/test/Transforms/NewGVN/pr31613.ll b/llvm/test/Transforms/NewGVN/pr31613.ll
index 943cdbc113dc40..0bcf86a5711189 100644
--- a/llvm/test/Transforms/NewGVN/pr31613.ll
+++ b/llvm/test/Transforms/NewGVN/pr31613.ll
@@ -74,7 +74,7 @@ declare void @c.d.p(i64, ptr)
define void @e(i32 %a0, i32 %a1, ptr %p2) {
; CHECK-LABEL: @e(
; CHECK-NEXT: [[F:%.*]] = alloca i32, align 4
-; CHECK-NEXT: store i32 [[A0:%.*]], ptr [[F]], align 4, !g !0
+; CHECK-NEXT: store i32 [[A0:%.*]], ptr [[F]], align 4, !g [[META0:![0-9]+]]
; CHECK-NEXT: br label [[H:%.*]]
; CHECK: h:
; CHECK-NEXT: call void @c.d.p(i64 8, ptr undef)
@@ -88,10 +88,10 @@ define void @e(i32 %a0, i32 %a1, ptr %p2) {
; CHECK-NEXT: br label [[R]]
; CHECK: r:
; CHECK-NEXT: switch i32 undef, label [[N:%.*]] [
-; CHECK-NEXT: i32 0, label [[S:%.*]]
+; CHECK-NEXT: i32 0, label [[S:%.*]]
; CHECK-NEXT: ]
; CHECK: s:
-; CHECK-NEXT: store i32 [[A1:%.*]], ptr [[F]], align 4, !g !0
+; CHECK-NEXT: store i32 [[A1:%.*]], ptr [[F]], align 4, !g [[META0]]
; CHECK-NEXT: br label [[H]]
; CHECK: n:
; CHECK-NEXT: ret void
diff --git a/llvm/test/Transforms/NewGVN/pr31682.ll b/llvm/test/Transforms/NewGVN/pr31682.ll
index 00a1bf2b84505a..3d8c9e28635c66 100644
--- a/llvm/test/Transforms/NewGVN/pr31682.ll
+++ b/llvm/test/Transforms/NewGVN/pr31682.ll
@@ -9,7 +9,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define void @bar() {
; CHECK-LABEL: @bar(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr @global
+; CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr @global, align 8
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2:
; CHECK-NEXT: br i1 undef, label [[BB2]], label [[BB7:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/pr31758.ll b/llvm/test/Transforms/NewGVN/pr31758.ll
index 43188430e34c22..274d605802a6bc 100644
--- a/llvm/test/Transforms/NewGVN/pr31758.ll
+++ b/llvm/test/Transforms/NewGVN/pr31758.ll
@@ -12,7 +12,7 @@ define void @tinkywinky() {
; CHECK: bb90:
; CHECK-NEXT: br label [[BB90]]
; CHECK: bb138:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[BB138:%.*]]
;
bb:
diff --git a/llvm/test/Transforms/NewGVN/pr32607.ll b/llvm/test/Transforms/NewGVN/pr32607.ll
index 4770724dc2baa8..7460ab5ec27e04 100644
--- a/llvm/test/Transforms/NewGVN/pr32607.ll
+++ b/llvm/test/Transforms/NewGVN/pr32607.ll
@@ -7,7 +7,7 @@ define hidden void @foo() {
; CHECK: if:
; CHECK-NEXT: br i1 false, label [[L50:%.*]], label [[IF]]
; CHECK: L50:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: ret void
;
top:
diff --git a/llvm/test/Transforms/NewGVN/pr32836.ll b/llvm/test/Transforms/NewGVN/pr32836.ll
index 5488655b3683d3..00f3fb07b20259 100644
--- a/llvm/test/Transforms/NewGVN/pr32836.ll
+++ b/llvm/test/Transforms/NewGVN/pr32836.ll
@@ -5,19 +5,19 @@
@b = external global %struct.anon
define void @tinkywinky(i1 %patatino) {
; CHECK-LABEL: @tinkywinky(
-; CHECK-NEXT: store i32 8, ptr null
+; CHECK-NEXT: store i32 8, ptr null, align 4
; CHECK-NEXT: br i1 [[PATATINO:%.*]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: br label [[L:%.*]]
; CHECK: L:
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
-; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr null
-; CHECK-NEXT: [[BF_LOAD1:%.*]] = load i32, ptr @b
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr null, align 4
+; CHECK-NEXT: [[BF_LOAD1:%.*]] = load i32, ptr @b, align 4
; CHECK-NEXT: [[BF_VALUE:%.*]] = and i32 [[TMP1]], 536870911
; CHECK-NEXT: [[BF_CLEAR:%.*]] = and i32 [[BF_LOAD1]], -536870912
; CHECK-NEXT: [[BF_SET:%.*]] = or i32 [[BF_CLEAR]], [[BF_VALUE]]
-; CHECK-NEXT: store i32 [[BF_SET]], ptr @b
+; CHECK-NEXT: store i32 [[BF_SET]], ptr @b, align 4
; CHECK-NEXT: br label [[LOR_END:%.*]]
; CHECK: lor.end:
; CHECK-NEXT: br label [[L]]
diff --git a/llvm/test/Transforms/NewGVN/pr32838.ll b/llvm/test/Transforms/NewGVN/pr32838.ll
index 5ba68fa15c24dc..87c93d9312e67c 100644
--- a/llvm/test/Transforms/NewGVN/pr32838.ll
+++ b/llvm/test/Transforms/NewGVN/pr32838.ll
@@ -10,7 +10,7 @@ define void @fn1(i64 noundef %arg) {
; CHECK: if.then:
; CHECK-NEXT: br i1 false, label [[FIRSTPHIBLOCK:%.*]], label [[TEMP:%.*]]
; CHECK: firstphiblock:
-; CHECK-NEXT: br i1 undef, label %for.cond17thread-pre-split, label [[SECONDPHIBLOCK:%.*]]
+; CHECK-NEXT: br i1 undef, label [[FOR_COND17THREAD_PRE_SPLIT:%.*]], label [[SECONDPHIBLOCK:%.*]]
; CHECK: secondphiblock:
; CHECK-NEXT: [[SECONDPHI:%.*]] = phi i64 [ [[THIRDPHI:%.*]], [[THIRDPHIBLOCK:%.*]] ], [ undef, [[FIRSTPHIBLOCK]] ]
; CHECK-NEXT: br i1 undef, label [[FIRSTPHIBLOCK]], label [[THIRDPHIBLOCK]]
@@ -55,7 +55,7 @@ define void @fn2(i64 noundef %arg) {
; CHECK-NEXT: br i1 false, label [[FIRSTPHIBLOCK:%.*]], label [[TEMP:%.*]]
; CHECK: firstphiblock:
; CHECK-NEXT: [[FIRSTPHI:%.*]] = phi i64 [ poison, [[IF_THEN]] ], [ [[SECONDPHI:%.*]], [[SECONDPHIBLOCK:%.*]] ]
-; CHECK-NEXT: br i1 undef, label %for.cond17thread-pre-split, label [[SECONDPHIBLOCK]]
+; CHECK-NEXT: br i1 undef, label [[FOR_COND17THREAD_PRE_SPLIT:%.*]], label [[SECONDPHIBLOCK]]
; CHECK: secondphiblock:
; CHECK-NEXT: [[SECONDPHI]] = phi i64 [ [[THIRDPHI:%.*]], [[THIRDPHIBLOCK:%.*]] ], [ [[FIRSTPHI]], [[FIRSTPHIBLOCK]] ]
; CHECK-NEXT: br i1 undef, label [[FIRSTPHIBLOCK]], label [[THIRDPHIBLOCK]]
@@ -65,7 +65,7 @@ define void @fn2(i64 noundef %arg) {
; CHECK: for.cond17thread-pre-split:
; CHECK-NEXT: br label [[COND_TRUE]]
; CHECK: cond.true:
-; CHECK-NEXT: [[FOURTHPHI:%.*]] = phi i64 [ [[ARG:%.*]], [[ENTRY:%.*]] ], [ [[FIRSTPHI]], %for.cond17thread-pre-split ]
+; CHECK-NEXT: [[FOURTHPHI:%.*]] = phi i64 [ [[ARG:%.*]], [[ENTRY:%.*]] ], [ [[FIRSTPHI]], [[FOR_COND17THREAD_PRE_SPLIT]] ]
; CHECK-NEXT: [[DIV]] = sdiv i64 [[FOURTHPHI]], 4
; CHECK-NEXT: br label [[THIRDPHIBLOCK]]
; CHECK: temp:
@@ -105,7 +105,7 @@ define void @fn3() {
; CHECK-NEXT: [[F_0:%.*]] = phi ptr [ @b, [[ENTRY:%.*]] ], [ @a, [[L1_LOOPEXIT:%.*]] ]
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond.loopexit:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: for.cond:
; CHECK-NEXT: br i1 undef, label [[FOR_END14:%.*]], label [[FOR_COND1_PREHEADER:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/pr32845.ll b/llvm/test/Transforms/NewGVN/pr32845.ll
index d1182a627c59c3..29b81b8e1c66a4 100644
--- a/llvm/test/Transforms/NewGVN/pr32845.ll
+++ b/llvm/test/Transforms/NewGVN/pr32845.ll
@@ -13,7 +13,7 @@ define void @tinkywinky() {
; CHECK-NEXT: [[F_0:%.*]] = phi ptr [ @b, [[ENTRY:%.*]] ], [ @a, [[L1_LOOPEXIT:%.*]] ]
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond.loopexit:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: for.cond:
; CHECK-NEXT: br i1 undef, label [[FOR_END14:%.*]], label [[FOR_COND1_PREHEADER:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/pr32852.ll b/llvm/test/Transforms/NewGVN/pr32852.ll
index 4fd5cf1a95fa72..ad5badd82fdf00 100644
--- a/llvm/test/Transforms/NewGVN/pr32852.ll
+++ b/llvm/test/Transforms/NewGVN/pr32852.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; Make sure GVN doesn't incorrectly think the branch terminating
; bb2 has a constant condition.
; RUN: opt -S -passes=newgvn %s | FileCheck %s
@@ -6,13 +7,26 @@
@patatino = private unnamed_addr constant [3 x i8] c"0\0A\00"
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr @a, align 4
+; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i32 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP1]], label [[BB2:%.*]], label [[BB7:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7]]
+; CHECK: bb5:
+; CHECK-NEXT: [[TMP6:%.*]] = call i32 (ptr, ...) @printf(ptr @patatino)
+; CHECK-NEXT: br label [[BB7]]
+; CHECK: bb7:
+; CHECK-NEXT: ret void
+;
bb:
%tmp = load i32, ptr @a
%tmp1 = icmp sge i32 %tmp, 0
br i1 %tmp1, label %bb2, label %bb7
bb2:
%tmp4 = icmp sgt i32 %tmp, 0
-; CHECK: br i1 %tmp4, label %bb5, label %bb7
br i1 %tmp4, label %bb5, label %bb7
bb5:
%tmp6 = call i32 (ptr, ...) @printf(ptr @patatino)
diff --git a/llvm/test/Transforms/NewGVN/pr32897.ll b/llvm/test/Transforms/NewGVN/pr32897.ll
index 35a3b0040bcaac..881c3a8e3ef538 100644
--- a/llvm/test/Transforms/NewGVN/pr32897.ll
+++ b/llvm/test/Transforms/NewGVN/pr32897.ll
@@ -6,7 +6,7 @@ define void @tinkywinky(ptr %b) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[BODY:%.*]]
; CHECK: body:
-; CHECK-NEXT: store i64 undef, ptr [[B:%.*]]
+; CHECK-NEXT: store i64 undef, ptr [[B:%.*]], align 4
; CHECK-NEXT: br i1 undef, label [[BODY]], label [[END:%.*]]
; CHECK: end:
; CHECK-NEXT: br label [[BODY]]
diff --git a/llvm/test/Transforms/NewGVN/pr32934.ll b/llvm/test/Transforms/NewGVN/pr32934.ll
index fa725f8888e7e3..c8218c209face4 100644
--- a/llvm/test/Transforms/NewGVN/pr32934.ll
+++ b/llvm/test/Transforms/NewGVN/pr32934.ll
@@ -1,39 +1,41 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn %s | FileCheck %s
-; CHECK: define void @tinkywinky() {
-; CHECK-NEXT: entry:
-; CHECK-NEXT: %d = alloca i32, align 4
-; CHECK-NEXT: store i32 0, ptr null, align 4
-; CHECK-NEXT: br label %for.cond
-; CHECK: for.cond: ; preds = %if.end, %entry
-; CHECK-NEXT: %0 = load i32, ptr null, align 4
-; CHECK-NEXT: %cmp = icmp slt i32 %0, 1
-; CHECK-NEXT: br i1 %cmp, label %for.body, label %while.cond
-; CHECK: for.body: ; preds = %for.cond
-; CHECK-NEXT: %1 = load i32, ptr @a, align 4
-; CHECK-NEXT: store i32 %1, ptr %d, align 4
-; CHECK-NEXT: br label %L
-; CHECK: L: ; preds = %if.then, %for.body
-; CHECK-NEXT: %tobool = icmp ne i32 %1, 0
-; CHECK-NEXT: br i1 %tobool, label %if.then, label %if.end
-; CHECK: if.then: ; preds = %L
-; CHECK-NEXT: call void (ptr, ...) @printf(ptr @patatino)
-; CHECK-NEXT: br label %L
-; CHECK: if.end: ; preds = %L
-; CHECK-NEXT: br label %for.cond
-; CHECK: while.cond: ; preds = %while.body, %for.cond
-; CHECK-NEXT: br i1 undef, label %while.body, label %while.end
-; CHECK: while.body: ; preds = %while.cond
-; CHECK-NEXT: call void (ptr, ...) @printf(ptr @patatino)
-; CHECK-NEXT: br label %while.cond
-; CHECK: while.end:
-; CHECK-NEXT: %2 = load i32, ptr @a, align 4
-; CHECK-NEXT: store i32 %2, ptr undef, align 4
-; CHECK-NEXT: ret void
@a = external global i32, align 4
@patatino = external unnamed_addr constant [2 x i8], align 1
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[D:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store i32 0, ptr null, align 4
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr null, align 4
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], 1
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[WHILE_COND:%.*]]
+; CHECK: for.body:
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @a, align 4
+; CHECK-NEXT: store i32 [[TMP1]], ptr [[D]], align 4
+; CHECK-NEXT: br label [[L:%.*]]
+; CHECK: L:
+; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: call void (ptr, ...) @printf(ptr @patatino)
+; CHECK-NEXT: br label [[L]]
+; CHECK: if.end:
+; CHECK-NEXT: br label [[FOR_COND]]
+; CHECK: while.cond:
+; CHECK-NEXT: br i1 undef, label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
+; CHECK: while.body:
+; CHECK-NEXT: call void (ptr, ...) @printf(ptr @patatino)
+; CHECK-NEXT: br label [[WHILE_COND]]
+; CHECK: while.end:
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr @a, align 4
+; CHECK-NEXT: store i32 [[TMP2]], ptr undef, align 4
+; CHECK-NEXT: ret void
+;
entry:
%d = alloca i32, align 4
store i32 0, ptr null, align 4
diff --git a/llvm/test/Transforms/NewGVN/pr32945.ll b/llvm/test/Transforms/NewGVN/pr32945.ll
index ebf3813c65bd5a..7aabe4df059520 100644
--- a/llvm/test/Transforms/NewGVN/pr32945.ll
+++ b/llvm/test/Transforms/NewGVN/pr32945.ll
@@ -1,9 +1,28 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn %s | FileCheck %s
-; CHECK-NOT: call i32 @llvm.ssa.copy
@d = external global i32
@e = external global i32
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: br i1 true, label [[LOR_LHS_FALSE:%.*]], label [[COND_TRUE:%.*]]
+; CHECK: lor.lhs.false:
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr @d, align 4
+; CHECK-NEXT: [[PATATINO:%.*]] = load i32, ptr null, align 4
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[TMP]], [[PATATINO]]
+; CHECK-NEXT: store i32 [[OR]], ptr @d, align 4
+; CHECK-NEXT: br label [[COND_TRUE]]
+; CHECK: cond.true:
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @e, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr @d, align 4
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP1]], [[TMP2]]
+; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE6:%.*]], label [[COND_FALSE:%.*]]
+; CHECK: cond.true6:
+; CHECK-NEXT: [[CMP7:%.*]] = icmp slt i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[CMP7]], label [[COND_FALSE]], label [[COND_FALSE]]
+; CHECK: cond.false:
+; CHECK-NEXT: ret void
+;
br i1 true, label %lor.lhs.false, label %cond.true
lor.lhs.false:
%tmp = load i32, ptr @d, align 4
diff --git a/llvm/test/Transforms/NewGVN/pr32952.ll b/llvm/test/Transforms/NewGVN/pr32952.ll
index 5157bb27e6c59b..49e4843294f574 100644
--- a/llvm/test/Transforms/NewGVN/pr32952.ll
+++ b/llvm/test/Transforms/NewGVN/pr32952.ll
@@ -1,3 +1,4 @@
+; 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
@@ -6,6 +7,31 @@
@.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
@@ -23,15 +49,11 @@ 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 (ptr, ...) @printf(ptr @.str, i32 %promoted)
diff --git a/llvm/test/Transforms/NewGVN/pr33014.ll b/llvm/test/Transforms/NewGVN/pr33014.ll
index f6e919770d6c62..04f9df2704a6c7 100644
--- a/llvm/test/Transforms/NewGVN/pr33014.ll
+++ b/llvm/test/Transforms/NewGVN/pr33014.ll
@@ -1,33 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; Make sure we don't end up in an infinite recursion in singleReachablePHIPath().
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
@c = external global i64, align 8
-; CHECK-LABEL: define void @tinkywinky() {
-; CHECK: entry:
-; CHECK-NEXT: br i1 undef, label %l2, label %if.then
-; CHECK: if.then: ; preds = %entry
-; CHECK-NEXT: br label %for.body
-; CHECK: ph: ; preds = %back, %ontrue
-; CHECK-NEXT: br label %for.body
-; CHECK: for.body: ; preds = %ph, %if.then
-; CHECK-NEXT: br i1 undef, label %ontrue, label %onfalse
-; CHECK: onfalse: ; preds = %for.body
-; CHECK-NEXT: %patatino = load i64, ptr @c
-; CHECK-NEXT: ret void
-; CHECK: ontrue: ; preds = %for.body
-; CHECK-NEXT: %dipsy = load i64, ptr @c
-; CHECK-NEXT: br label %ph
-; CHECK: back: ; preds = %l2
-; CHECK-NEXT: store i8 poison, ptr null
-; CHECK-NEXT: br label %ph
-; CHECK: end: ; preds = %l2
-; CHECK-NEXT: ret void
-; CHECK: l2: ; preds = %entry
-; CHECK-NEXT: br i1 false, label %back, label %end
-; CHECK-NEXT: }
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 undef, label [[L2:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: br label [[FOR_BODY:%.*]]
+; CHECK: ph:
+; CHECK-NEXT: br label [[FOR_BODY]]
+; CHECK: for.body:
+; CHECK-NEXT: br i1 undef, label [[ONTRUE:%.*]], label [[ONFALSE:%.*]]
+; CHECK: onfalse:
+; CHECK-NEXT: [[PATATINO:%.*]] = load i64, ptr @c, align 4
+; CHECK-NEXT: ret void
+; CHECK: ontrue:
+; CHECK-NEXT: [[DIPSY:%.*]] = load i64, ptr @c, align 4
+; CHECK-NEXT: br label [[PH:%.*]]
+; CHECK: back:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[PH]]
+; CHECK: end:
+; CHECK-NEXT: ret void
+; CHECK: l2:
+; CHECK-NEXT: br i1 false, label [[BACK:%.*]], label [[END:%.*]]
+;
entry:
br i1 undef, label %l2, label %if.then
if.then:
diff --git a/llvm/test/Transforms/NewGVN/pr33086.ll b/llvm/test/Transforms/NewGVN/pr33086.ll
index 54802cdbd92585..ab6c00dd1777ff 100644
--- a/llvm/test/Transforms/NewGVN/pr33086.ll
+++ b/llvm/test/Transforms/NewGVN/pr33086.ll
@@ -1,31 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S %s | FileCheck %s
; REQUIRES: asserts
-; CHECK-LABEL: define void @tinkywinky() {
-; CHECK: entry:
-; CHECK-NEXT: br i1 undef, label %for.cond18, label %for.cond.preheader
-; CHECK: for.cond.preheader:
-; CHECK-NEXT: br label %for.cond2thread-pre-split
-; CHECK: for.cond2thread-pre-split:
-; CHECK-NEXT: %conv24 = phi i32 [ 0, %for.cond.preheader ], [ %conv, %for.inc.split ]
-; CHECK-NEXT: br label %for.inc.split
-; CHECK: for.inc.split:
-; CHECK-NEXT: %add = shl nsw i32 %conv24, 16
-; CHECK-NEXT: %sext23 = add i32 %add, 65536
-; CHECK-NEXT: %conv = ashr exact i32 %sext23, 16
-; CHECK-NEXT: %cmp = icmp slt i32 %sext23, 3604480
-; CHECK-NEXT: br i1 %cmp, label %for.cond2thread-pre-split, label %l1.loopexit
-; CHECK: l1.loopexit:
-; CHECK-NEXT: br label %l1
-; CHECK: l1:
-; CHECK-NEXT: %0 = load i16, ptr null, align 2
-; CHECK-NEXT: %g.0.g.0..pr = load i16, ptr null, align 2
-; CHECK-NEXT: ret void
-; CHECK: for.cond18:
-; CHECK-NEXT: br label %l1
-; CHECK-NEXT: }
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 undef, label [[FOR_COND18:%.*]], label [[FOR_COND_PREHEADER:%.*]]
+; CHECK: for.cond.preheader:
+; CHECK-NEXT: br label [[FOR_COND2THREAD_PRE_SPLIT:%.*]]
+; CHECK: for.cond2thread-pre-split:
+; CHECK-NEXT: [[CONV24:%.*]] = phi i32 [ 0, [[FOR_COND_PREHEADER]] ], [ [[CONV:%.*]], [[FOR_INC_SPLIT:%.*]] ]
+; CHECK-NEXT: br label [[FOR_INC_SPLIT]]
+; CHECK: for.inc.split:
+; CHECK-NEXT: [[ADD:%.*]] = shl nsw i32 [[CONV24]], 16
+; CHECK-NEXT: [[SEXT23:%.*]] = add i32 [[ADD]], 65536
+; CHECK-NEXT: [[CONV]] = ashr exact i32 [[SEXT23]], 16
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[SEXT23]], 3604480
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND2THREAD_PRE_SPLIT]], label [[L1_LOOPEXIT:%.*]]
+; CHECK: l1.loopexit:
+; CHECK-NEXT: br label [[L1:%.*]]
+; CHECK: l1:
+; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr null, align 2
+; CHECK-NEXT: [[G_0_G_0__PR:%.*]] = load i16, ptr null, align 2
+; CHECK-NEXT: ret void
+; CHECK: for.cond18:
+; CHECK-NEXT: br label [[L1]]
+;
entry:
br i1 undef, label %for.cond18, label %for.cond.preheader
diff --git a/llvm/test/Transforms/NewGVN/pr33116.ll b/llvm/test/Transforms/NewGVN/pr33116.ll
index f5ef3ae7575ee5..6609ef9e72dac6 100644
--- a/llvm/test/Transforms/NewGVN/pr33116.ll
+++ b/llvm/test/Transforms/NewGVN/pr33116.ll
@@ -13,7 +13,7 @@ define void @b() {
; CHECK: c:
; CHECK-NEXT: br i1 undef, label [[IF_G:%.*]], label [[IF_E]]
; CHECK: if.g:
-; CHECK-NEXT: store i32 undef, ptr @a
+; CHECK-NEXT: store i32 undef, ptr @a, align 4
; CHECK-NEXT: br label [[WHILE_D]]
; CHECK: if.e:
; CHECK-NEXT: br label [[F]]
diff --git a/llvm/test/Transforms/NewGVN/pr33187.ll b/llvm/test/Transforms/NewGVN/pr33187.ll
index e5c3da2fb05a9e..37668bba3d5b60 100644
--- a/llvm/test/Transforms/NewGVN/pr33187.ll
+++ b/llvm/test/Transforms/NewGVN/pr33187.ll
@@ -30,7 +30,7 @@ define void @fn1() local_unnamed_addr #0 {
; CHECK: while.body12:
; CHECK-NEXT: br i1 undef, label [[IF_END18]], label [[L]]
; CHECK: L.loopexit:
-; CHECK-NEXT: store i8 poison, ptr null
+; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[L]]
; CHECK: L:
; CHECK-NEXT: [[H_125]] = phi i32 [ [[H_127]], [[WHILE_BODY12]] ], [ poison, [[L_LOOPEXIT]] ]
@@ -114,13 +114,13 @@ attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="fals
define void @a() {
; CHECK-LABEL: @a(
; CHECK-NEXT: b:
-; CHECK-NEXT: store ptr null, ptr null
+; CHECK-NEXT: store ptr null, ptr null, align 8
; CHECK-NEXT: br label [[D:%.*]]
; CHECK: d:
; CHECK-NEXT: [[I:%.*]] = phi ptr [ null, [[B:%.*]] ], [ [[E:%.*]], [[F:%.*]] ]
; CHECK-NEXT: br i1 undef, label [[F]], label [[G:%.*]]
; CHECK: g:
-; CHECK-NEXT: store ptr [[I]], ptr null
+; CHECK-NEXT: store ptr [[I]], ptr null, align 8
; CHECK-NEXT: unreachable
; CHECK: f:
; CHECK-NEXT: [[E]] = getelementptr i8, ptr [[I]], i64 1
diff --git a/llvm/test/Transforms/NewGVN/pr33196.ll b/llvm/test/Transforms/NewGVN/pr33196.ll
index c312d5ec979304..c04b895fa47e96 100644
--- a/llvm/test/Transforms/NewGVN/pr33196.ll
+++ b/llvm/test/Transforms/NewGVN/pr33196.ll
@@ -1,33 +1,6 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=newgvn %s | FileCheck %s
-; CHECK: define i32 @main() {
-; CHECK-NEXT: entry:
-; CHECK-NEXT: %tmp = load i32, ptr @d, align 4
-; CHECK-NEXT: %tmp1 = load i32, ptr @c, align 4
-; CHECK-NEXT: %tobool = icmp eq i32 %tmp1, -1
-; CHECK-NEXT: br i1 %tobool, label %if.end, label %if.then
-; CHECK: if.then:
-; CHECK-NEXT: br label %L
-; CHECK: L:
-; CHECK-NEXT: %e.0 = phi i32 [ 0, %if.then ], [ %e.1, %if.then4 ]
-; CHECK-NEXT: br label %if.end
-; CHECK: if.end:
-; CHECK-NEXT: %e.1 = phi i32 [ %e.0, %L ], [ %tmp, %entry ]
-; CHECK-NEXT: store i32 %e.1, ptr @a, align 4
-; CHECK-NEXT: %tmp2 = load i32, ptr @b, align 4
-; CHECK-NEXT: store i32 0, ptr @b, align 4
-; CHECK-NEXT: %sext = shl i32 %tmp2, 16
-; CHECK-NEXT: %conv1 = ashr exact i32 %sext, 16
-; CHECK-NEXT: %add = add nsw i32 %conv1, %tmp1
-; CHECK-NEXT: %add2 = add nsw i32 %add, %e.1
-; CHECK-NEXT: store i32 %add2, ptr @a, align 4
-; CHECK-NEXT: %tobool3 = icmp eq i32 %add2, 0
-; CHECK-NEXT: br i1 %tobool3, label %if.end5, label %if.then4
-; CHECK: if.then4:
-; CHECK-NEXT: br label %L
-; CHECK: if.end5:
-; CHECK-NEXT: ret i32 0
-; CHECK-NEXT: }
@d = global i32 1, align 4
@c = common global i32 0, align 4
@@ -35,6 +8,34 @@
@b = common global i32 0, align 4
define i32 @main() {
+; CHECK-LABEL: define i32 @main() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr @d, align 4
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @c, align 4
+; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP1]], -1
+; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: br label [[L:%.*]]
+; CHECK: L:
+; CHECK-NEXT: [[E_0:%.*]] = phi i32 [ 0, [[IF_THEN]] ], [ [[E_1:%.*]], [[IF_THEN4:%.*]] ]
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: [[E_1]] = phi i32 [ [[E_0]], [[L]] ], [ [[TMP]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: store i32 [[E_1]], ptr @a, align 4
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr @b, align 4
+; CHECK-NEXT: store i32 0, ptr @b, align 4
+; CHECK-NEXT: [[SEXT:%.*]] = shl i32 [[TMP2]], 16
+; CHECK-NEXT: [[CONV1:%.*]] = ashr exact i32 [[SEXT]], 16
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV1]], [[TMP1]]
+; CHECK-NEXT: [[ADD2:%.*]] = add nsw i32 [[ADD]], [[E_1]]
+; CHECK-NEXT: store i32 [[ADD2]], ptr @a, align 4
+; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[ADD2]], 0
+; CHECK-NEXT: br i1 [[TOBOOL3]], label [[IF_END5:%.*]], label [[IF_THEN4]]
+; CHECK: if.then4:
+; CHECK-NEXT: br label [[L]]
+; CHECK: if.end5:
+; CHECK-NEXT: ret i32 0
+;
entry:
%tmp = load i32, ptr @d, align 4
%tmp1 = load i32, ptr @c, align 4
diff --git a/llvm/test/Transforms/NewGVN/pr33204.ll b/llvm/test/Transforms/NewGVN/pr33204.ll
index 99c48241a75c68..482e35e7fdb11f 100644
--- a/llvm/test/Transforms/NewGVN/pr33204.ll
+++ b/llvm/test/Transforms/NewGVN/pr33204.ll
@@ -20,10 +20,10 @@ define void @hoge(i32 %arg) {
; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ 0, [[BB1:%.*]] ], [ [[ARG:%.*]], [[BB:%.*]] ]
; CHECK-NEXT: br label [[BB6:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr @global, align 4, !h !0
+; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr @global, align 4, !h [[META0:![0-9]+]]
; CHECK-NEXT: unreachable
; CHECK: bb6:
-; CHECK-NEXT: store i32 [[TMP]], ptr @global.1, align 4, !h !0
+; CHECK-NEXT: store i32 [[TMP]], ptr @global.1, align 4, !h [[META0]]
; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB1]]
; CHECK: bb7:
; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB8:%.*]]
@@ -33,7 +33,7 @@ define void @hoge(i32 %arg) {
; CHECK-NEXT: store i8 poison, ptr null, align 1
; CHECK-NEXT: br label [[BB3]]
; CHECK: bb10:
-; CHECK-NEXT: store i32 0, ptr @global, align 4, !h !0
+; CHECK-NEXT: store i32 0, ptr @global, align 4, !h [[META0]]
; CHECK-NEXT: br label [[BB7]]
;
bb:
diff --git a/llvm/test/Transforms/NewGVN/pr33305.ll b/llvm/test/Transforms/NewGVN/pr33305.ll
index f87cf08e2abf73..3a19f610defcd7 100644
--- a/llvm/test/Transforms/NewGVN/pr33305.ll
+++ b/llvm/test/Transforms/NewGVN/pr33305.ll
@@ -19,14 +19,14 @@ target triple = "x86_64-apple-macosx10.12.0"
define i32 @main() local_unnamed_addr #0 {
; CHECK-LABEL: @main(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DOTPR_I:%.*]] = load i32, ptr @c, align 4, !tbaa !3
+; CHECK-NEXT: [[DOTPR_I:%.*]] = load i32, ptr @c, align 4, !tbaa [[TBAA3:![0-9]+]]
; CHECK-NEXT: [[CMP13_I:%.*]] = icmp slt i32 [[DOTPR_I]], 1
; CHECK-NEXT: br i1 [[CMP13_I]], label [[FOR_COND1_PREHEADER_LR_PH_I:%.*]], label [[ENTRY_FOR_END9_I_CRIT_EDGE:%.*]]
; CHECK: entry.for.end9.i_crit_edge:
-; CHECK-NEXT: [[DOTPRE:%.*]] = load i32, ptr @h, align 4, !tbaa !3
+; CHECK-NEXT: [[DOTPRE:%.*]] = load i32, ptr @h, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: br label [[FOR_END9_I:%.*]]
; CHECK: for.cond1.preheader.lr.ph.i:
-; CHECK-NEXT: [[G_PROMOTED14_I:%.*]] = load i32, ptr @g, align 4, !tbaa !3
+; CHECK-NEXT: [[G_PROMOTED14_I:%.*]] = load i32, ptr @g, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: br label [[FOR_COND1_PREHEADER_I:%.*]]
; CHECK: for.cond1.preheader.i:
; CHECK-NEXT: [[INC816_I:%.*]] = phi i32 [ [[DOTPR_I]], [[FOR_COND1_PREHEADER_LR_PH_I]] ], [ [[INC8_I:%.*]], [[FOR_INC7_I:%.*]] ]
@@ -42,9 +42,9 @@ define i32 @main() local_unnamed_addr #0 {
; CHECK: lor.rhs.i:
; CHECK-NEXT: [[LNOT_I:%.*]] = xor i1 [[TOBOOL_I]], true
; CHECK-NEXT: [[LNOT_EXT_I:%.*]] = zext i1 [[LNOT_I]] to i32
-; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr @e, align 4, !tbaa !3
+; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr @e, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: [[XOR_I:%.*]] = xor i32 [[TMP3]], [[LNOT_EXT_I]]
-; CHECK-NEXT: store i32 [[XOR_I]], ptr @e, align 4, !tbaa !3
+; CHECK-NEXT: store i32 [[XOR_I]], ptr @e, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: br label [[LOR_END_I]]
; CHECK: lor.end.i:
; CHECK-NEXT: [[INC_I]] = add nuw nsw i32 [[INC12_I]], 1
@@ -55,28 +55,28 @@ define i32 @main() local_unnamed_addr #0 {
; CHECK-NEXT: [[CMP_I:%.*]] = icmp slt i32 [[INC816_I]], 0
; CHECK-NEXT: br i1 [[CMP_I]], label [[FOR_COND1_PREHEADER_I]], label [[FOR_COND_FOR_END9_CRIT_EDGE_I:%.*]]
; CHECK: for.cond.for.end9_crit_edge.i:
-; CHECK-NEXT: store i32 0, ptr @g, align 4, !tbaa !3
-; CHECK-NEXT: store i32 2, ptr @h, align 4, !tbaa !3
-; CHECK-NEXT: store i32 [[INC8_I]], ptr @c, align 4, !tbaa !3
+; CHECK-NEXT: store i32 0, ptr @g, align 4, !tbaa [[TBAA3]]
+; CHECK-NEXT: store i32 2, ptr @h, align 4, !tbaa [[TBAA3]]
+; CHECK-NEXT: store i32 [[INC8_I]], ptr @c, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: br label [[FOR_END9_I]]
; CHECK: for.end9.i:
; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ [[DOTPRE]], [[ENTRY_FOR_END9_I_CRIT_EDGE]] ], [ 2, [[FOR_COND_FOR_END9_CRIT_EDGE_I]] ]
-; CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr @b, align 8, !tbaa !7
-; CHECK-NEXT: store i32 [[TMP4]], ptr [[TMP5]], align 4, !tbaa !3
-; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr @e, align 4, !tbaa !3
+; CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr @b, align 8, !tbaa [[TBAA7:![0-9]+]]
+; CHECK-NEXT: store i32 [[TMP4]], ptr [[TMP5]], align 4, !tbaa [[TBAA3]]
+; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr @e, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: [[CMP10_I:%.*]] = icmp slt i32 [[TMP6]], -1
; CHECK-NEXT: br i1 [[CMP10_I]], label [[IF_THEN_I:%.*]], label [[FN1_EXIT:%.*]]
; CHECK: if.then.i:
-; CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr @f, align 4, !tbaa !3
-; CHECK-NEXT: store i32 [[TMP7]], ptr [[TMP5]], align 4, !tbaa !3
+; CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr @f, align 4, !tbaa [[TBAA3]]
+; CHECK-NEXT: store i32 [[TMP7]], ptr [[TMP5]], align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: br label [[FN1_EXIT]]
; CHECK: fn1.exit:
-; CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr @a, align 4, !tbaa !3
+; CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr @a, align 4, !tbaa [[TBAA3]]
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP8]], 0
; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[PUTS2:%.*]] = tail call i32 @puts(ptr @str.2)
-; CHECK-NEXT: tail call void @abort()
+; CHECK-NEXT: tail call void @abort() #[[ATTR3:[0-9]+]]
; CHECK-NEXT: unreachable
; CHECK: if.end:
; CHECK-NEXT: [[PUTS:%.*]] = tail call i32 @puts(ptr @str)
diff --git a/llvm/test/Transforms/NewGVN/pr33367.ll b/llvm/test/Transforms/NewGVN/pr33367.ll
index dc5d190291e1cc..597caa2b34ef28 100644
--- a/llvm/test/Transforms/NewGVN/pr33367.ll
+++ b/llvm/test/Transforms/NewGVN/pr33367.ll
@@ -11,19 +11,19 @@ define %MNR_struct @f000316011717_2(ptr %pDS, ptr %pCG) #2 {
; CHECK-NEXT: Entry:
; CHECK-NEXT: [[RESTART:%.*]] = alloca [[MNR_STRUCT:%.*]], align 8
; CHECK-NEXT: [[PCARRY:%.*]] = getelementptr [[DS_STRUCT:%.*]], ptr [[PDS:%.*]], i32 0, i32 1
-; CHECK-NEXT: [[BASE:%.*]] = load ptr, ptr [[PDS]], align 8, !tbaa !14
+; CHECK-NEXT: [[BASE:%.*]] = load ptr, ptr [[PDS]], align 8, !tbaa [[TBAA14:![0-9]+]]
; CHECK-NEXT: [[ABSADDR:%.*]] = getelementptr i64, ptr [[BASE]], i64 9
-; CHECK-NEXT: [[EXTARGET:%.*]] = load i64, ptr [[ABSADDR]], align 8, !tbaa !4
+; CHECK-NEXT: [[EXTARGET:%.*]] = load i64, ptr [[ABSADDR]], align 8, !tbaa [[TBAA4:![0-9]+]]
; CHECK-NEXT: [[TEMPLATE:%.*]] = icmp eq i64 [[EXTARGET]], 8593987412
; CHECK-NEXT: br i1 [[TEMPLATE]], label %"BB3.000316011731#1", label [[BB2_000316011731_5:%.*]]
; CHECK: "BB3.000316011731#1":
; CHECK-NEXT: [[PBASE8:%.*]] = getelementptr [32 x ptr], ptr [[PDS]], i64 0, i64 29
-; CHECK-NEXT: [[BASE9:%.*]] = load ptr, ptr [[PBASE8]], align 8, !tbaa !14
+; CHECK-NEXT: [[BASE9:%.*]] = load ptr, ptr [[PBASE8]], align 8, !tbaa [[TBAA14]]
; CHECK-NEXT: [[ABSADDR1:%.*]] = getelementptr i64, ptr [[BASE9]], i64 7
-; CHECK-NEXT: [[RMEM:%.*]] = load i64, ptr [[ABSADDR1]], align 8, !tbaa !4
+; CHECK-NEXT: [[RMEM:%.*]] = load i64, ptr [[ABSADDR1]], align 8, !tbaa [[TBAA4]]
; CHECK-NEXT: [[PWT:%.*]] = getelementptr [[DS_STRUCT]], ptr [[PDS]], i32 0, i32 2
; CHECK-NEXT: [[PWTE:%.*]] = getelementptr [32 x i16], ptr [[PWT]], i64 0, i64 8593987412
-; CHECK-NEXT: [[SHIFTS:%.*]] = load i16, ptr [[PWTE]], align 2, !tbaa !18, !invariant.load !20
+; CHECK-NEXT: [[SHIFTS:%.*]] = load i16, ptr [[PWTE]], align 2, !tbaa [[TBAA18:![0-9]+]], !invariant.load [[META20:![0-9]+]]
; CHECK-NEXT: [[SLOWJ:%.*]] = icmp eq i16 [[SHIFTS]], 0
; CHECK-NEXT: br i1 [[SLOWJ]], label [[BB2_000316011731_5]], label %"BB3.000316011731#1.1"
; CHECK: BB2.000316011731.5:
@@ -34,22 +34,22 @@ define %MNR_struct @f000316011717_2(ptr %pDS, ptr %pCG) #2 {
; CHECK-NEXT: [[SHIFTS1:%.*]] = zext i16 [[SHIFTS]] to i64
; CHECK-NEXT: [[VAL:%.*]] = call i64 @llvm.x86.bmi.bextr.64(i64 [[RMEM]], i64 [[SHIFTS1]])
; CHECK-NEXT: [[PREG:%.*]] = getelementptr [64 x i64], ptr [[PCG:%.*]], i64 0, i64 12
-; CHECK-NEXT: store i64 [[VAL]], ptr [[PREG]], align 32, !tbaa !10
+; CHECK-NEXT: store i64 [[VAL]], ptr [[PREG]], align 32, !tbaa [[TBAA10:![0-9]+]]
; CHECK-NEXT: [[PREG2:%.*]] = getelementptr [64 x i64], ptr [[PCG]], i64 0, i64 14
-; CHECK-NEXT: [[REG:%.*]] = load i64, ptr [[PREG2]], align 16, !tbaa !12
-; CHECK-NEXT: [[BASE2:%.*]] = load ptr, ptr [[PBASE8]], align 8, !tbaa !14
+; CHECK-NEXT: [[REG:%.*]] = load i64, ptr [[PREG2]], align 16, !tbaa [[TBAA12:![0-9]+]]
+; CHECK-NEXT: [[BASE2:%.*]] = load ptr, ptr [[PBASE8]], align 8, !tbaa [[TBAA14]]
; CHECK-NEXT: [[ABSADDR2:%.*]] = getelementptr i64, ptr [[BASE2]], i64 [[REG]]
-; CHECK-NEXT: [[RMEM2:%.*]] = load i64, ptr [[ABSADDR2]], align 8, !tbaa !1
+; CHECK-NEXT: [[RMEM2:%.*]] = load i64, ptr [[ABSADDR2]], align 8, !tbaa [[TBAA1:![0-9]+]]
; CHECK-NEXT: [[PREG7:%.*]] = getelementptr [64 x i64], ptr [[PCG]], i64 0, i64 9
-; CHECK-NEXT: store i64 [[RMEM2]], ptr [[PREG7]], align 8, !tbaa !8
+; CHECK-NEXT: store i64 [[RMEM2]], ptr [[PREG7]], align 8, !tbaa [[TBAA8:![0-9]+]]
; CHECK-NEXT: [[ADD2C279:%.*]] = add i64 [[RMEM2]], [[VAL]]
; CHECK-NEXT: [[CCHK:%.*]] = icmp sge i64 [[ADD2C279]], 0
; CHECK-NEXT: [[CFL:%.*]] = zext i1 [[CCHK]] to i8
-; CHECK-NEXT: store i8 [[CFL]], ptr [[PCARRY]], align 1, !tbaa !16
+; CHECK-NEXT: store i8 [[CFL]], ptr [[PCARRY]], align 1, !tbaa [[TBAA16:![0-9]+]]
; CHECK-NEXT: br label [[EXIT]]
; CHECK: Exit:
; CHECK-NEXT: [[RESTART378:%.*]] = load [[MNR_STRUCT]], ptr [[RESTART]], align 8
-; CHECK-NEXT: ret [[MNR_STRUCT]] %restart378
+; CHECK-NEXT: ret [[MNR_STRUCT]] [[RESTART378]]
;
Entry:
%restart = alloca %MNR_struct
diff --git a/llvm/test/Transforms/NewGVN/pr34452.ll b/llvm/test/Transforms/NewGVN/pr34452.ll
index f5d5fda343037c..9e65349a1b47be 100644
--- a/llvm/test/Transforms/NewGVN/pr34452.ll
+++ b/llvm/test/Transforms/NewGVN/pr34452.ll
@@ -9,7 +9,7 @@ source_filename = "bugpoint-output-09f7a24.bc"
define void @sgrep() local_unnamed_addr #0 {
; CHECK-LABEL: @sgrep(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @WHOLELINE, align 4, !tbaa !1
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @WHOLELINE, align 4, !tbaa [[TBAA1:![0-9]+]]
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0
; CHECK-NEXT: [[DOT:%.*]] = select i1 [[TOBOOL]], i32 2048, i32 2047
; CHECK-NEXT: br label [[WHILE_BODY_US:%.*]]
diff --git a/llvm/test/Transforms/NewGVN/pr42422-phi-of-ops.ll b/llvm/test/Transforms/NewGVN/pr42422-phi-of-ops.ll
index cbdf209d1ce50c..1312f9f4f02967 100644
--- a/llvm/test/Transforms/NewGVN/pr42422-phi-of-ops.ll
+++ b/llvm/test/Transforms/NewGVN/pr42422-phi-of-ops.ll
@@ -40,8 +40,8 @@ define void @d() {
; CHECK: cleanup:
; CHECK-NEXT: [[CLEANUP_DEST:%.*]] = phi i32 [ poison, [[IF_END12]] ], [ 1, [[IF_THEN11]] ], [ 9, [[IF_THEN]] ]
; CHECK-NEXT: switch i32 [[CLEANUP_DEST]], label [[CLEANUP14]] [
-; CHECK-NEXT: i32 0, label [[FOR_COND4]]
-; CHECK-NEXT: i32 9, label [[FOR_END13:%.*]]
+; CHECK-NEXT: i32 0, label [[FOR_COND4]]
+; CHECK-NEXT: i32 9, label [[FOR_END13:%.*]]
; CHECK-NEXT: ]
; CHECK: for.end13:
; CHECK-NEXT: br label [[CLEANUP14]]
diff --git a/llvm/test/Transforms/NewGVN/pr43441.ll b/llvm/test/Transforms/NewGVN/pr43441.ll
index 5c4a9c3bc7b5d1..a5f711dbd69e5f 100644
--- a/llvm/test/Transforms/NewGVN/pr43441.ll
+++ b/llvm/test/Transforms/NewGVN/pr43441.ll
@@ -1,15 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-; CHECK-LABEL: @print_long_format()
define dso_local void @print_long_format() #0 {
+; CHECK-LABEL: define dso_local void @print_long_format(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: switch i32 undef, label [[SW_DEFAULT:%.*]] [
+; CHECK-NEXT: i32 1, label [[SW_BB:%.*]]
+; CHECK-NEXT: i32 0, label [[SW_BB19:%.*]]
+; CHECK-NEXT: i32 2, label [[SW_BB23:%.*]]
+; CHECK-NEXT: ]
+; CHECK: sw.bb:
+; CHECK-NEXT: unreachable
+; CHECK: sw.bb19:
+; CHECK-NEXT: br i1 undef, label [[IF_THEN37:%.*]], label [[IF_END50:%.*]]
+; CHECK: sw.bb23:
+; CHECK-NEXT: unreachable
+; CHECK: sw.default:
+; CHECK-NEXT: unreachable
+; CHECK: if.then37:
+; CHECK-NEXT: unreachable
+; CHECK: if.end50:
+; CHECK-NEXT: [[CALL180:%.*]] = call i32 @timespec_cmp() #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: ret void
+;
entry:
switch i32 undef, label %sw.default [
- i32 1, label %sw.bb
- i32 0, label %sw.bb19
- i32 2, label %sw.bb23
+ i32 1, label %sw.bb
+ i32 0, label %sw.bb19
+ i32 2, label %sw.bb23
]
sw.bb: ; preds = %entry
diff --git a/llvm/test/Transforms/NewGVN/pre-compare.ll b/llvm/test/Transforms/NewGVN/pre-compare.ll
index 9fd20fcc76ed69..8e4e5f813e89a2 100644
--- a/llvm/test/Transforms/NewGVN/pre-compare.ll
+++ b/llvm/test/Transforms/NewGVN/pre-compare.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
; C source:
@@ -37,6 +38,28 @@
@.str3 = private unnamed_addr constant [12 x i8] c"step 2: %d\0A\00", align 1
define void @f(i32 %x) noreturn nounwind uwtable ssp {
+; CHECK-LABEL: define void @f(
+; CHECK-SAME: i32 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 1
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND_PREHEADER:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[X]], 2
+; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP1]], ptr @.str, ptr @.str1
+; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @puts(ptr [[COND]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: br label [[FOR_COND_PREHEADER]]
+; CHECK: for.cond.preheader:
+; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i32 [[X]], 2
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond:
+; CHECK-NEXT: [[CALL2:%.*]] = tail call i32 @puts(ptr @.str2) #[[ATTR1]]
+; CHECK-NEXT: br i1 [[CMP3]], label [[FOR_COND_BACKEDGE:%.*]], label [[IF_END5:%.*]]
+; CHECK: if.end5:
+; CHECK-NEXT: [[CALL6:%.*]] = tail call i32 (ptr, ...) @printf(ptr @.str3, i32 [[X]]) #[[ATTR1]]
+; CHECK-NEXT: br label [[FOR_COND_BACKEDGE]]
+; CHECK: for.cond.backedge:
+; CHECK-NEXT: br label [[FOR_COND]]
+;
entry:
%cmp = icmp eq i32 %x, 1
br i1 %cmp, label %for.cond.preheader, label %if.then
diff --git a/llvm/test/Transforms/NewGVN/preserve-metadata-for-predicate-replacements.ll b/llvm/test/Transforms/NewGVN/preserve-metadata-for-predicate-replacements.ll
index 1ca24af84e48aa..a63ca131b5c0dd 100644
--- a/llvm/test/Transforms/NewGVN/preserve-metadata-for-predicate-replacements.ll
+++ b/llvm/test/Transforms/NewGVN/preserve-metadata-for-predicate-replacements.ll
@@ -9,7 +9,7 @@ declare void @use(i32)
define i32 @test(ptr %p1, ptr %p2, i1 %c) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LV:%.*]] = load i32, ptr [[P1:%.*]], align 8, !tbaa !0
+; CHECK-NEXT: [[LV:%.*]] = load i32, ptr [[P1:%.*]], align 8, !tbaa [[TBAA0:![0-9]+]]
; CHECK-NEXT: [[CMP_1:%.*]] = icmp slt i32 [[LV]], 1
; CHECK-NEXT: br i1 [[CMP_1]], label [[EXIT:%.*]], label [[IF_FALSE:%.*]]
; CHECK: if.false:
diff --git a/llvm/test/Transforms/NewGVN/readattrs.ll b/llvm/test/Transforms/NewGVN/readattrs.ll
index 049a2fc911687b..544fe45be24976 100644
--- a/llvm/test/Transforms/NewGVN/readattrs.ll
+++ b/llvm/test/Transforms/NewGVN/readattrs.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S -o - < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
@@ -6,12 +7,15 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @use(ptr readonly nocapture)
define i8 @test() {
+; CHECK-LABEL: define i8 @test() {
+; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
+; CHECK-NEXT: store i8 1, ptr [[A]], align 1
+; CHECK-NEXT: call void @use(ptr [[A]])
+; CHECK-NEXT: ret i8 1
+;
%a = alloca i8
store i8 1, ptr %a
call void @use(ptr %a)
%b = load i8, ptr %a
ret i8 %b
-; CHECK-LABEL: define i8 @test(
-; CHECK: call void @use(ptr %a)
-; CHECK-NEXT: ret i8 1
}
diff --git a/llvm/test/Transforms/NewGVN/rle-nonlocal.ll b/llvm/test/Transforms/NewGVN/rle-nonlocal.ll
index c2fb39100da45f..efdfd1f6dc7b5b 100644
--- a/llvm/test/Transforms/NewGVN/rle-nonlocal.ll
+++ b/llvm/test/Transforms/NewGVN/rle-nonlocal.ll
@@ -7,14 +7,14 @@ define i32 @main(ptr %p, i32 %x, i32 %y) {
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: br i1 [[CMP]], label [[BLOCK2:%.*]], label [[BLOCK3:%.*]]
; CHECK: block2:
-; CHECK-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]]
+; CHECK-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]], align 8
; CHECK-NEXT: br label [[BLOCK4:%.*]]
; CHECK: block3:
-; CHECK-NEXT: [[B:%.*]] = load ptr, ptr [[P]]
+; CHECK-NEXT: [[B:%.*]] = load ptr, ptr [[P]], align 8
; CHECK-NEXT: br label [[BLOCK4]]
; CHECK: block4:
; CHECK-NEXT: [[EXISTINGPHI:%.*]] = phi ptr [ [[A]], [[BLOCK2]] ], [ [[B]], [[BLOCK3]] ]
-; CHECK-NEXT: [[C:%.*]] = load i32, ptr [[EXISTINGPHI]]
+; CHECK-NEXT: [[C:%.*]] = load i32, ptr [[EXISTINGPHI]], align 4
; CHECK-NEXT: [[E:%.*]] = add i32 [[C]], [[C]]
; CHECK-NEXT: ret i32 [[E]]
;
diff --git a/llvm/test/Transforms/NewGVN/rle.ll b/llvm/test/Transforms/NewGVN/rle.ll
index 1cfdc83f40da05..950c492d873652 100644
--- a/llvm/test/Transforms/NewGVN/rle.ll
+++ b/llvm/test/Transforms/NewGVN/rle.ll
@@ -1,15 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -data-layout="e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-n8:16:32" -passes=newgvn,dce -S | FileCheck %s
; RUN: opt < %s -data-layout="E-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-n32" -passes=newgvn,dce -S | FileCheck %s
; memset -> i16 forwarding.
define signext i16 @memset_to_i16_local(ptr %A) nounwind ssp {
+; CHECK-LABEL: define signext i16 @memset_to_i16_local(
+; CHECK-SAME: ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr [[A]], i8 1, i64 200, i1 false)
+; CHECK-NEXT: ret i16 257
+;
entry:
tail call void @llvm.memset.p0.i64(ptr %A, i8 1, i64 200, i1 false)
%arrayidx = getelementptr inbounds i16, ptr %A, i64 42
%tmp2 = load i16, ptr %arrayidx
ret i16 %tmp2
-; CHECK-LABEL: @memset_to_i16_local(
-; CHECK-NOT: load
-; CHECK: ret i16 257
}
@GCst = constant {i32, float, i32 } { i32 42, float 14., i32 97 }
@@ -17,37 +21,48 @@ entry:
; memset -> float forwarding.
define float @memcpy_to_float_local(ptr %A) nounwind ssp {
+; CHECK-LABEL: define float @memcpy_to_float_local(
+; CHECK-SAME: ptr [[A:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr [[A]], ptr @GCst, i64 12, i1 false)
+; CHECK-NEXT: ret float 1.400000e+01
+;
entry:
tail call void @llvm.memcpy.p0.p0.i64(ptr %A, ptr @GCst, i64 12, i1 false)
%arrayidx = getelementptr inbounds float, ptr %A, i64 1 ; <ptr> [#uses=1]
%tmp2 = load float, ptr %arrayidx ; <float> [#uses=1]
ret float %tmp2
-; CHECK-LABEL: @memcpy_to_float_local(
-; CHECK-NOT: load
-; CHECK: ret float 1.400000e+01
}
; memcpy from address space 1
define float @memcpy_to_float_local_as1(ptr %A) nounwind ssp {
+; CHECK-LABEL: define float @memcpy_to_float_local_as1(
+; CHECK-SAME: ptr [[A:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: tail call void @llvm.memcpy.p0.p1.i64(ptr [[A]], ptr addrspace(1) @GCst_as1, i64 12, i1 false)
+; CHECK-NEXT: ret float 1.400000e+01
+;
entry:
tail call void @llvm.memcpy.p0.p1.i64(ptr %A, ptr addrspace(1) @GCst_as1, i64 12, i1 false)
%arrayidx = getelementptr inbounds float, ptr %A, i64 1 ; <ptr> [#uses=1]
%tmp2 = load float, ptr %arrayidx ; <float> [#uses=1]
ret float %tmp2
-; CHECK-LABEL: @memcpy_to_float_local_as1(
-; CHECK-NOT: load
-; CHECK: ret float 1.400000e+01
}
; PR6642
define i32 @memset_to_load() nounwind readnone {
+; CHECK-LABEL: define i32 @memset_to_load(
+; CHECK-SAME: ) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[X:%.*]] = alloca [256 x i32], align 4
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[X]], i8 0, i64 1024, i1 false)
+; CHECK-NEXT: ret i32 0
+;
entry:
%x = alloca [256 x i32], align 4 ; <ptr> [#uses=2]
call void @llvm.memset.p0.i64(ptr align 4 %x, i8 0, i64 1024, i1 false)
%arraydecay = getelementptr inbounds [256 x i32], ptr %x, i32 0, i32 0 ; <ptr>
%tmp1 = load i32, ptr %arraydecay ; <i32> [#uses=1]
ret i32 %tmp1
-; CHECK-LABEL: @memset_to_load(
-; CHECK: ret i32 0
}
declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
diff --git a/llvm/test/Transforms/NewGVN/simp-to-self.ll b/llvm/test/Transforms/NewGVN/simp-to-self.ll
index fb8a01962959bc..f9a0ec257259a1 100644
--- a/llvm/test/Transforms/NewGVN/simp-to-self.ll
+++ b/llvm/test/Transforms/NewGVN/simp-to-self.ll
@@ -1,13 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S < %s -passes=newgvn | FileCheck %s
-; CHECK-LABEL: for.cond:
-; CHECK-NEXT: %lv = load i32, ptr @a
-; CHECK-NEXT: %bf.clear = and i32 %lv, -131072
-; CHECK-NEXT: %bf.set = or i32 1, %bf.clear
-; CHECK-NEXT: br i1 %bc, label %for.cond, label %exit
@a = external global i64
define void @fn1(i1 %bc) {
+; CHECK-LABEL: define void @fn1(
+; CHECK-SAME: i1 [[BC:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond:
+; CHECK-NEXT: [[LV:%.*]] = load i32, ptr @a, align 4
+; CHECK-NEXT: [[BF_CLEAR:%.*]] = and i32 [[LV]], -131072
+; CHECK-NEXT: [[BF_SET:%.*]] = or i32 1, [[BF_CLEAR]]
+; CHECK-NEXT: br i1 [[BC]], label [[FOR_COND]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: store i32 [[BF_SET]], ptr @a, align 4
+; CHECK-NEXT: ret void
+;
entry:
br label %for.cond
diff --git a/llvm/test/Transforms/NewGVN/stale-loop-info.ll b/llvm/test/Transforms/NewGVN/stale-loop-info.ll
index 8870824d38ad6d..7abe80b005ecf2 100644
--- a/llvm/test/Transforms/NewGVN/stale-loop-info.ll
+++ b/llvm/test/Transforms/NewGVN/stale-loop-info.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes='require<loops>,newgvn' -S < %s | FileCheck %s
; This used to fail with ASAN enabled and if for some reason LoopInfo remained
@@ -14,6 +15,29 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
declare void @snork.1(ptr) local_unnamed_addr #0
define hidden zeroext i1 @eggs(ptr %arg, i1 %arg2) unnamed_addr align 2 {
+; CHECK-LABEL: define hidden zeroext i1 @eggs(
+; CHECK-SAME: ptr [[ARG:%.*]], i1 [[ARG2:%.*]]) unnamed_addr align 2 {
+; CHECK-NEXT: bb:
+; CHECK-NEXT: br i1 [[ARG2]], label [[BB14:%.*]], label [[BB3:%.*]]
+; CHECK: bb3:
+; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[STRUCT_WIBBLE_1028:%.*]], ptr [[ARG]], i64 0, i32 2, i32 0, i32 0, i64 0
+; CHECK-NEXT: br label [[BB6:%.*]]
+; CHECK: bb6:
+; CHECK-NEXT: br label [[BB7:%.*]]
+; CHECK: bb7:
+; CHECK-NEXT: br i1 undef, label [[BB11:%.*]], label [[BB8:%.*]]
+; CHECK: bb8:
+; CHECK-NEXT: [[TMP9:%.*]] = load ptr, ptr [[TMP]], align 8
+; CHECK-NEXT: br label [[BB12:%.*]]
+; CHECK: bb11:
+; CHECK-NEXT: br label [[BB12]]
+; CHECK: bb12:
+; CHECK-NEXT: [[TMP13:%.*]] = phi ptr [ [[TMP]], [[BB11]] ], [ [[TMP9]], [[BB8]] ]
+; CHECK-NEXT: call void @snork.1(ptr [[TMP13]]) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: br label [[BB6]]
+; CHECK: bb14:
+; CHECK-NEXT: ret i1 false
+;
bb:
br i1 %arg2, label %bb14, label %bb3
@@ -29,7 +53,6 @@ bb7: ; preds = %bb6
bb8: ; preds = %bb7
%tmp9 = load ptr, ptr %tmp, align 8
-; CHECK: %tmp9 = load ptr, ptr %tmp, align 8
br label %bb12
bb11: ; preds = %bb7
diff --git a/llvm/test/Transforms/NewGVN/tbaa.ll b/llvm/test/Transforms/NewGVN/tbaa.ll
index e6d66dca0decff..335e782acc8bcd 100644
--- a/llvm/test/Transforms/NewGVN/tbaa.ll
+++ b/llvm/test/Transforms/NewGVN/tbaa.ll
@@ -1,10 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
define i32 @test1(ptr %p, ptr %q) {
-; CHECK-LABEL: @test1(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p)
-; CHECK-NOT: tbaa
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test1(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]])
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !0
%b = call i32 @foo(ptr %p)
%c = add i32 %a, %b
@@ -12,9 +15,12 @@ define i32 @test1(ptr %p, ptr %q) {
}
define i32 @test2(ptr %p, ptr %q) {
-; CHECK-LABEL: @test2(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGC:!.*]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test2(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !0
%b = call i32 @foo(ptr %p), !tbaa !0
%c = add i32 %a, %b
@@ -22,9 +28,12 @@ define i32 @test2(ptr %p, ptr %q) {
}
define i32 @test3(ptr %p, ptr %q) {
-; CHECK-LABEL: @test3(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGB:!.*]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test3(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA4:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !3
%b = call i32 @foo(ptr %p), !tbaa !3
%c = add i32 %a, %b
@@ -32,9 +41,12 @@ define i32 @test3(ptr %p, ptr %q) {
}
define i32 @test4(ptr %p, ptr %q) {
-; CHECK-LABEL: @test4(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA:!.*]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test4(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !1
%b = call i32 @foo(ptr %p), !tbaa !0
%c = add i32 %a, %b
@@ -42,9 +54,12 @@ define i32 @test4(ptr %p, ptr %q) {
}
define i32 @test5(ptr %p, ptr %q) {
-; CHECK-LABEL: @test5(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test5(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !0
%b = call i32 @foo(ptr %p), !tbaa !1
%c = add i32 %a, %b
@@ -52,9 +67,12 @@ define i32 @test5(ptr %p, ptr %q) {
}
define i32 @test6(ptr %p, ptr %q) {
-; CHECK-LABEL: @test6(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test6(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !0
%b = call i32 @foo(ptr %p), !tbaa !3
%c = add i32 %a, %b
@@ -62,10 +80,12 @@ define i32 @test6(ptr %p, ptr %q) {
}
define i32 @test7(ptr %p, ptr %q) {
-; CHECK-LABEL: @test7(ptr %p, ptr %q)
-; CHECK: call i32 @foo(ptr %p)
-; CHECK-NOT: tbaa
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test7(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]])
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !4
%b = call i32 @foo(ptr %p), !tbaa !3
%c = add i32 %a, %b
@@ -73,9 +93,11 @@ define i32 @test7(ptr %p, ptr %q) {
}
define i32 @test8(ptr %p, ptr %q) {
-; CHECK-LABEL: @test8
-; CHECK-NEXT: store i32 15, ptr %p
-; CHECK-NEXT: ret i32 0
+; CHECK-LABEL: define i32 @test8(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: store i32 15, ptr [[P]], align 4
+; CHECK-NEXT: ret i32 0
+;
; Since we know the location is invariant, we can forward the
; load across the potentially aliasing store.
@@ -87,9 +109,11 @@ define i32 @test8(ptr %p, ptr %q) {
}
define i32 @test9(ptr %p, ptr %q) {
-; CHECK-LABEL: @test9
-; CHECK-NEXT: call void @clobber()
-; CHECK-NEXT: ret i32 0
+; CHECK-LABEL: define i32 @test9(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: call void @clobber()
+; CHECK-NEXT: ret i32 0
+;
; Since we know the location is invariant, we can forward the
; load across the potentially aliasing store (within the call).
@@ -103,9 +127,12 @@ define i32 @test9(ptr %p, ptr %q) {
define i32 @test10(ptr %p, ptr %q) {
; If one access encloses the other, then the merged access is the enclosed one
; and not just the common final access type.
-; CHECK-LABEL: @test10
-; CHECK: call i32 @foo(ptr %p), !tbaa [[TAG_X_i:!.*]]
-; CHECK: %c = add i32 %a, %a
+; CHECK-LABEL: define i32 @test10(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
+; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA7:![0-9]+]]
+; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
+; CHECK-NEXT: ret i32 [[C]]
+;
%a = call i32 @foo(ptr %p), !tbaa !15 ; TAG_X_i
%b = call i32 @foo(ptr %p), !tbaa !19 ; TAG_Y_x_i
%c = add i32 %a, %b
@@ -115,12 +142,6 @@ define i32 @test10(ptr %p, ptr %q) {
declare void @clobber()
declare i32 @foo(ptr) readonly
-; CHECK-DAG: [[TAGC]] = !{[[TYPEC:!.*]], [[TYPEC]], i64 0}
-; CHECK-DAG: [[TYPEC]] = !{!"C", [[TYPEA:!.*]]}
-; CHECK-DAG: [[TYPEA]] = !{!"A", !{{.*}}}
-; CHECK-DAG: [[TAGB]] = !{[[TYPEB:!.*]], [[TYPEB]], i64 0}
-; CHECK-DAG: [[TYPEB]] = !{!"B", [[TYPEA]]}
-; CHECK-DAG: [[TAGA]] = !{[[TYPEA]], [[TYPEA]], i64 0}
!0 = !{!5, !5, i64 0}
!1 = !{!6, !6, i64 0}
!2 = !{!"tbaa root"}
@@ -132,9 +153,6 @@ declare i32 @foo(ptr) readonly
!8 = !{!"another root"}
!11 = !{!"scalar type", !8}
-; CHECK-DAG: [[TAG_X_i]] = !{[[TYPE_X:!.*]], [[TYPE_int:!.*]], i64 0}
-; CHECK-DAG: [[TYPE_X:!.*]] = !{!"struct X", [[TYPE_int]], i64 0}
-; CHECK-DAG: [[TYPE_int]] = !{!"int", {{!.*}}, i64 0}
!15 = !{!16, !17, i64 0} ; TAG_X_i
!16 = !{!"struct X", !17, i64 0} ; struct X { int i; };
!17 = !{!"int", !18, i64 0}
@@ -146,3 +164,16 @@ declare i32 @foo(ptr) readonly
; A TBAA structure who's only point is to have a constant location.
!9 = !{!"yet another root"}
!10 = !{!"node", !9, i64 1}
+;.
+; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0}
+; CHECK: [[META1]] = !{!"C", [[META2:![0-9]+]]}
+; CHECK: [[META2]] = !{!"A", [[META3:![0-9]+]]}
+; CHECK: [[META3]] = !{!"tbaa root"}
+; CHECK: [[TBAA4]] = !{[[META5:![0-9]+]], [[META5]], i64 0}
+; CHECK: [[META5]] = !{!"B", [[META2]]}
+; CHECK: [[TBAA6]] = !{[[META2]], [[META2]], i64 0}
+; CHECK: [[TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 0}
+; CHECK: [[META8]] = !{!"struct X", [[META9]], i64 0}
+; CHECK: [[META9]] = !{!"int", [[META10:![0-9]+]], i64 0}
+; CHECK: [[META10]] = !{!"char", [[META3]], i64 0}
+;.
diff --git a/llvm/test/Transforms/NewGVN/unreachable_block_infinite_loop.ll b/llvm/test/Transforms/NewGVN/unreachable_block_infinite_loop.ll
index 7fbf50680a32e9..70e5e1a138da7e 100644
--- a/llvm/test/Transforms/NewGVN/unreachable_block_infinite_loop.ll
+++ b/llvm/test/Transforms/NewGVN/unreachable_block_infinite_loop.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -disable-output < %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
@@ -5,11 +6,11 @@ target triple = "x86_64-apple-darwin10.0"
define i32 @test2() nounwind ssp {
entry:
- ret i32 0
+ ret i32 0
unreachable_block:
- %a = add i32 %a, 1
- ret i32 %a
+ %a = add i32 %a, 1
+ ret i32 %a
}
define i32 @pr23096_test0() {
diff --git a/llvm/test/Transforms/NewGVN/verify-memoryphi.ll b/llvm/test/Transforms/NewGVN/verify-memoryphi.ll
index b863d23cffdc3f..2a1fcf35157f46 100644
--- a/llvm/test/Transforms/NewGVN/verify-memoryphi.ll
+++ b/llvm/test/Transforms/NewGVN/verify-memoryphi.ll
@@ -1,21 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; Skip dead MemoryPhis when performing memory congruency verification
; in NewGVN.
; RUN: opt -S -passes=newgvn %s | FileCheck %s
; REQUIRES: asserts
-; CHECK: define void @tinkywinky() {
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 false, label %body, label %end
-; CHECK: body:
-; CHECK-NEXT: store i8 poison, ptr null
-; CHECK-NEXT: br label %end
-; CHECK: end:
-; CHECK-NEXT: ret void
-; CHECK-NEXT: }
declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
define void @tinkywinky() {
+; CHECK-LABEL: define void @tinkywinky() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 false, label [[BODY:%.*]], label [[END:%.*]]
+; CHECK: body:
+; CHECK-NEXT: store i8 poison, ptr null, align 1
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: ret void
+;
entry:
call void @llvm.lifetime.start.p0(i64 4, ptr undef)
br i1 false, label %body, label %end
diff --git a/llvm/test/Transforms/NewGVN/volatile-nonvolatile.ll b/llvm/test/Transforms/NewGVN/volatile-nonvolatile.ll
index 2febea7e948196..d6daff99591f9a 100644
--- a/llvm/test/Transforms/NewGVN/volatile-nonvolatile.ll
+++ b/llvm/test/Transforms/NewGVN/volatile-nonvolatile.ll
@@ -1,13 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes=newgvn -S < %s | FileCheck %s
%struct.t = type { ptr }
; The loaded address and the location of the address itself are not aliased,
; so the second reload is not necessary. Check that it can be eliminated.
-; CHECK-LABEL: test1
-; CHECK: load
-; CHECK-NOT: load
define void @test1(ptr nocapture readonly %p, i32 %v) #0 {
+; CHECK-LABEL: define void @test1(
+; CHECK-SAME: ptr nocapture readonly [[P:%.*]], i32 [[V:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[P]], align 4, !tbaa [[TBAA0:![0-9]+]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP0]], align 4, !tbaa [[TBAA5:![0-9]+]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP0]], align 4, !tbaa [[TBAA5]]
+; CHECK-NEXT: ret void
+;
entry:
%0 = load ptr, ptr %p, align 4, !tbaa !1
store volatile i32 %v, ptr %0, align 4, !tbaa !6
@@ -18,11 +24,16 @@ entry:
; The store via the loaded address may overwrite the address itself.
; Make sure that both loads remain.
-; CHECK-LABEL: test2
-; CHECK: load
-; CHECK: store
-; CHECK: load
define void @test2(ptr nocapture readonly %p, i32 %v) #0 {
+; CHECK-LABEL: define void @test2(
+; CHECK-SAME: ptr nocapture readonly [[P:%.*]], i32 [[V:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[P]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP0]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[P]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP1]], align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: ret void
+;
entry:
%0 = load ptr, ptr %p, align 4, !tbaa !1
store volatile i32 %v, ptr %0, align 4, !tbaa !1
@@ -33,11 +44,16 @@ entry:
; The loads are ordered and non-monotonic. Although they are not aliased to
; the stores, make sure both are preserved.
-; CHECK-LABEL: test3
-; CHECK: load
-; CHECK: store
-; CHECK: load
define void @test3(ptr nocapture readonly %p, i32 %v) #0 {
+; CHECK-LABEL: define void @test3(
+; CHECK-SAME: ptr nocapture readonly [[P:%.*]], i32 [[V:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load atomic ptr, ptr [[P]] acquire, align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP0]], align 4, !tbaa [[TBAA5]]
+; CHECK-NEXT: [[TMP1:%.*]] = load atomic ptr, ptr [[P]] acquire, align 4, !tbaa [[TBAA0]]
+; CHECK-NEXT: store volatile i32 [[V]], ptr [[TMP1]], align 4, !tbaa [[TBAA5]]
+; CHECK-NEXT: ret void
+;
entry:
%0 = load atomic ptr, ptr %p acquire, align 4, !tbaa !1
store volatile i32 %v, ptr %0, align 4, !tbaa !6
@@ -56,3 +72,12 @@ attributes #0 = { norecurse nounwind }
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !4, i64 0}
+;.
+; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META2:![0-9]+]], i64 0}
+; CHECK: [[META1]] = !{!"", [[META2]], i64 0}
+; CHECK: [[META2]] = !{!"any pointer", [[META3:![0-9]+]], i64 0}
+; CHECK: [[META3]] = !{!"omnipotent char", [[META4:![0-9]+]], i64 0}
+; CHECK: [[META4]] = !{!"Simple C/C++ TBAA"}
+; CHECK: [[TBAA5]] = !{[[META6:![0-9]+]], [[META6]], i64 0}
+; CHECK: [[META6]] = !{!"int", [[META3]], i64 0}
+;.
More information about the llvm-commits
mailing list