Skip to content

Commit

Permalink
[SimpleLoopUnswitch] Convert tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jan 4, 2023
1 parent e87aa92 commit 2f79f54
Show file tree
Hide file tree
Showing 47 changed files with 1,192 additions and 1,199 deletions.
@@ -1,10 +1,10 @@
; RUN: opt < %s -passes=simple-loop-unswitch -verify-memoryssa -disable-output

%struct.BLEND_MAP = type { i16, i16, i16, i32, %struct.BLEND_MAP_ENTRY* }
%struct.BLEND_MAP = type { i16, i16, i16, i32, ptr }
%struct.BLEND_MAP_ENTRY = type { float, i8, { [5 x float], [4 x i8] } }
%struct.TPATTERN = type { i16, i16, i16, i32, float, float, float, %struct.WARP*, %struct.TPATTERN*, %struct.BLEND_MAP*, { %struct.anon, [4 x i8] } }
%struct.TURB = type { i16, %struct.WARP*, [3 x double], i32, float, float }
%struct.WARP = type { i16, %struct.WARP* }
%struct.TPATTERN = type { i16, i16, i16, i32, float, float, float, ptr, ptr, ptr, { %struct.anon, [4 x i8] } }
%struct.TURB = type { i16, ptr, [3 x double], i32, float, float }
%struct.WARP = type { i16, ptr }
%struct.anon = type { float, [3 x double] }

define void @Parse_Pattern() {
Expand All @@ -13,14 +13,14 @@ entry:
bb671: ; preds = %cond_true1099
br label %bb1096.outer23
bb1096.outer20.loopexit: ; preds = %cond_true1099
%Local_Turb.0.ph24.lcssa = phi %struct.TURB* [ %Local_Turb.0.ph24, %cond_true1099 ] ; <%struct.TURB*> [#uses=1]
%Local_Turb.0.ph24.lcssa = phi ptr [ %Local_Turb.0.ph24, %cond_true1099 ] ; <ptr> [#uses=1]
br label %bb1096.outer20
bb1096.outer20: ; preds = %bb1096.outer20.loopexit, %entry
%Local_Turb.0.ph22 = phi %struct.TURB* [ undef, %entry ], [ %Local_Turb.0.ph24.lcssa, %bb1096.outer20.loopexit ] ; <%struct.TURB*> [#uses=1]
%Local_Turb.0.ph22 = phi ptr [ undef, %entry ], [ %Local_Turb.0.ph24.lcssa, %bb1096.outer20.loopexit ] ; <ptr> [#uses=1]
%tmp1098 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br label %bb1096.outer23
bb1096.outer23: ; preds = %bb1096.outer20, %bb671
%Local_Turb.0.ph24 = phi %struct.TURB* [ %Local_Turb.0.ph22, %bb1096.outer20 ], [ null, %bb671 ] ; <%struct.TURB*> [#uses=2]
%Local_Turb.0.ph24 = phi ptr [ %Local_Turb.0.ph22, %bb1096.outer20 ], [ null, %bb671 ] ; <ptr> [#uses=2]
br label %bb1096
bb1096: ; preds = %cond_true1099, %bb1096.outer23
br i1 %tmp1098, label %cond_true1099, label %bb1102
Expand All @@ -30,6 +30,6 @@ cond_true1099: ; preds = %bb1096
i32 359, label %bb1096
]
bb1102: ; preds = %bb1096
%Local_Turb.0.ph24.lcssa1 = phi %struct.TURB* [ %Local_Turb.0.ph24, %bb1096 ] ; <%struct.TURB*> [#uses=0]
%Local_Turb.0.ph24.lcssa1 = phi ptr [ %Local_Turb.0.ph24, %bb1096 ] ; <ptr> [#uses=0]
ret void
}
Expand Up @@ -3,8 +3,8 @@

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"
target triple = "i686-pc-linux-gnu"
%struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* }
%struct.ada__tags__dispatch_table = type { [1 x i8*] }
%struct.ada__streams__root_stream_type = type { ptr }
%struct.ada__tags__dispatch_table = type { [1 x ptr] }
%struct.quotes__T173s = type { i8, %struct.quotes__T173s__T174s, [2 x [1 x double]], [2 x i16], i64, i8 }
%struct.quotes__T173s__T174s = type { i8, i8, i8, i16, i16, [2 x [1 x double]] }

Expand Down
@@ -1,6 +1,6 @@
; RUN: opt < %s -passes='loop(simple-loop-unswitch),instcombine' -verify-memoryssa -disable-output

@str3 = external constant [3 x i8] ; <[3 x i8]*> [#uses=1]
@str3 = external constant [3 x i8] ; <ptr> [#uses=1]

define i32 @stringSearch_Clib(i32 %count) {
entry:
Expand All @@ -15,9 +15,9 @@ bb36.outer: ; preds = %bb41, %bb36.preheader
br i1 %ttmp33, label %bb.nph, label %bb41

bb.nph: ; preds = %bb36.outer
%ttmp8 = icmp eq i8* null, null ; <i1> [#uses=1]
%ttmp6 = icmp eq i8* null, null ; <i1> [#uses=1]
%tmp31 = call i32 @strcspn( i8* null, i8* getelementptr ([3 x i8], [3 x i8]* @str3, i64 0, i64 0) ) ; <i32> [#uses=1]
%ttmp8 = icmp eq ptr null, null ; <i1> [#uses=1]
%ttmp6 = icmp eq ptr null, null ; <i1> [#uses=1]
%tmp31 = call i32 @strcspn( ptr null, ptr @str3 ) ; <i32> [#uses=1]
br i1 %ttmp8, label %cond_next, label %cond_true

cond_true: ; preds = %bb.nph
Expand All @@ -42,4 +42,4 @@ bb44: ; preds = %bb41, %entry
ret i32 %c.01.1
}

declare i32 @strcspn(i8*, i8*)
declare i32 @strcspn(ptr, ptr)
@@ -1,6 +1,6 @@
; RUN: opt < %s -passes=simple-loop-unswitch -verify-memoryssa -disable-output

define i32 @main(i32 %argc, i8** %argv) {
define i32 @main(i32 %argc, ptr %argv) {
entry:
%tmp1785365 = icmp ult i32 0, 100 ; <i1> [#uses=1]
br label %bb
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Transforms/SimpleLoopUnswitch/2007-07-18-DomInfo.ll
Expand Up @@ -2,9 +2,9 @@
; PR1559

target triple = "i686-pc-linux-gnu"
%struct.re_pattern_buffer = type { i8*, i32, i32, i32, i8*, i8*, i32, i8 }
%struct.re_pattern_buffer = type { ptr, i32, i32, i32, ptr, ptr, i32, i8 }

define fastcc i32 @byte_regex_compile(i8* %pattern, i32 %size, i32 %syntax, %struct.re_pattern_buffer* %bufp) {
define fastcc i32 @byte_regex_compile(ptr %pattern, i32 %size, i32 %syntax, ptr %bufp) {
entry:
br i1 false, label %bb147, label %cond_next123

Expand Down Expand Up @@ -33,16 +33,16 @@ cond_true1849: ; preds = %cond_next1844
br label %bb1855.outer.outer

bb1855.outer.outer: ; preds = %cond_true1849, %bb1734
%b.10.ph.ph = phi i8* [ null, %cond_true1849 ], [ null, %bb1734 ] ; <i8*> [#uses=1]
%b.10.ph.ph = phi ptr [ null, %cond_true1849 ], [ null, %bb1734 ] ; <ptr> [#uses=1]
br label %bb1855.outer

bb1855.outer: ; preds = %bb1855.outer.outer, %cond_next1844
%b.10.ph = phi i8* [ null, %cond_next1844 ], [ %b.10.ph.ph, %bb1855.outer.outer ] ; <i8*> [#uses=1]
%tmp1837 = icmp eq i8* null, null ; <i1> [#uses=2]
%b.10.ph = phi ptr [ null, %cond_next1844 ], [ %b.10.ph.ph, %bb1855.outer.outer ] ; <ptr> [#uses=1]
%tmp1837 = icmp eq ptr null, null ; <i1> [#uses=2]
br i1 false, label %cond_true1831, label %cond_next1915

cond_next1915: ; preds = %cond_next1961, %bb1855.outer
store i8* null, i8** null
store ptr null, ptr null
br i1 %tmp1837, label %cond_next1929, label %cond_true1923

cond_true1923: ; preds = %cond_next1915
Expand All @@ -52,7 +52,7 @@ cond_next1929: ; preds = %cond_next1915
br i1 false, label %cond_next1961, label %cond_next2009

cond_next1961: ; preds = %cond_next1929
%tmp1992 = getelementptr i8, i8* %b.10.ph, i32 0 ; <i8*> [#uses=0]
%tmp1992 = getelementptr i8, ptr %b.10.ph, i32 0 ; <ptr> [#uses=0]
br label %cond_next1915

cond_next2009: ; preds = %cond_next1929
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimpleLoopUnswitch/2007-08-01-Dom.ll
Expand Up @@ -3,7 +3,7 @@

%struct.QBasicAtomic = type { i32 }

define void @_ZNK5QDate9addMonthsEi(%struct.QBasicAtomic* sret(%struct.QBasicAtomic) %agg.result, %struct.QBasicAtomic* %this, i32 %nmonths) {
define void @_ZNK5QDate9addMonthsEi(ptr sret(%struct.QBasicAtomic) %agg.result, ptr %this, i32 %nmonths) {
entry:
br label %cond_true90

Expand All @@ -17,7 +17,7 @@ bb53: ; preds = %bb45
br i1 false, label %bb93, label %cond_true90

bb58: ; preds = %bb45
store i32 0, i32* null, align 4
store i32 0, ptr null, align 4
br i1 false, label %cond_true90, label %bb93

cond_true90: ; preds = %bb58, %bb53, %bb16, %entry
Expand Down
30 changes: 15 additions & 15 deletions llvm/test/Transforms/SimpleLoopUnswitch/2007-08-01-LCSSA.ll
@@ -1,26 +1,26 @@
; RUN: opt < %s -passes='loop(simple-loop-unswitch),instcombine' -verify-memoryssa -disable-output
%struct.ClassDef = type { %struct.QByteArray, %struct.QByteArray, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", i8, i8, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", i32, i32 }
%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
%struct.Generator = type { %struct.FILE*, %struct.ClassDef*, %"struct.QList<ArgumentDef>", %struct.QByteArray, %"struct.QList<ArgumentDef>" }
%struct.FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i32, i32, [40 x i8] }
%struct.Generator = type { ptr, ptr, %"struct.QList<ArgumentDef>", %struct.QByteArray, %"struct.QList<ArgumentDef>" }
%struct.QBasicAtomic = type { i32 }
%struct.QByteArray = type { %"struct.QByteArray::Data"* }
%"struct.QByteArray::Data" = type { %struct.QBasicAtomic, i32, i32, i8*, [1 x i8] }
%struct.QByteArray = type { ptr }
%"struct.QByteArray::Data" = type { %struct.QBasicAtomic, i32, i32, ptr, [1 x i8] }
%"struct.QList<ArgumentDef>" = type { %"struct.QList<ArgumentDef>::._19" }
%"struct.QList<ArgumentDef>::._19" = type { %struct.QListData }
%struct.QListData = type { %"struct.QListData::Data"* }
%"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x i8*] }
%struct.QListData = type { ptr }
%"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x ptr] }
%"struct.QMap<QByteArray,QByteArray>" = type { %"struct.QMap<QByteArray,QByteArray>::._56" }
%"struct.QMap<QByteArray,QByteArray>::._56" = type { %struct.QMapData* }
%struct.QMapData = type { %struct.QMapData*, [12 x %struct.QMapData*], %struct.QBasicAtomic, i32, i32, i32, i8 }
%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
@.str9 = external constant [1 x i8] ; <[1 x i8]*> [#uses=1]
%"struct.QMap<QByteArray,QByteArray>::._56" = type { ptr }
%struct.QMapData = type { ptr, [12 x ptr], %struct.QBasicAtomic, i32, i32, i32, i8 }
%struct._IO_marker = type { ptr, ptr, i32 }
@.str9 = external constant [1 x i8] ; <ptr> [#uses=1]

declare i32 @strcmp(i8*, i8*)
declare i32 @strcmp(ptr, ptr)

define i32 @_ZN9Generator6strregEPKc(%struct.Generator* %this, i8* %s) {
define i32 @_ZN9Generator6strregEPKc(ptr %this, ptr %s) {
entry:
%s_addr.0 = select i1 false, i8* getelementptr ([1 x i8], [1 x i8]* @.str9, i32 0, i32 0), i8* %s ; <i8*> [#uses=2]
%tmp122 = icmp eq i8* %s_addr.0, null ; <i1> [#uses=1]
%s_addr.0 = select i1 false, ptr @.str9, ptr %s ; <ptr> [#uses=2]
%tmp122 = icmp eq ptr %s_addr.0, null ; <i1> [#uses=1]
br label %bb184

bb55: ; preds = %bb184
Expand All @@ -30,7 +30,7 @@ bb88: ; preds = %bb184
br i1 %tmp122, label %bb154, label %bb128

bb128: ; preds = %bb88
%tmp138 = call i32 @strcmp( i8* null, i8* %s_addr.0 ) ; <i32> [#uses=1]
%tmp138 = call i32 @strcmp( ptr null, ptr %s_addr.0 ) ; <i32> [#uses=1]
%iftmp.37.0.in4 = icmp eq i32 %tmp138, 0 ; <i1> [#uses=1]
br i1 %iftmp.37.0.in4, label %bb250, label %bb166

Expand Down
@@ -1,20 +1,20 @@
; RUN: opt < %s -passes='loop-mssa(licm),loop-unroll' -disable-output

@resonant = external global i32 ; <i32*> [#uses=2]
@resonant = external global i32 ; <ptr> [#uses=2]

define void @weightadj() {
entry:
br label %bb

bb: ; preds = %bb158, %entry
store i32 0, i32* @resonant, align 4
store i32 0, ptr @resonant, align 4
br i1 false, label %g.exit, label %bb158

g.exit: ; preds = %bb68, %bb
br i1 false, label %bb68, label %cond_true

cond_true: ; preds = %g.exit
store i32 1, i32* @resonant, align 4
store i32 1, ptr @resonant, align 4
br label %bb68

bb68: ; preds = %cond_true, %g.exit
Expand Down
@@ -1,5 +1,5 @@
; RUN: opt < %s -passes=licm,simple-loop-unswitch -disable-output
@g_56 = external global i16 ; <i16*> [#uses=2]
@g_56 = external global i16 ; <ptr> [#uses=2]

define i32 @func_67(i32 %p_68, i8 signext %p_69, i8 signext %p_71) nounwind {
entry:
Expand All @@ -14,9 +14,9 @@ bb19: ; preds = %bb3
bb29: ; preds = %bb19, %bb3
ret i32 0
bb36: ; preds = %bb19
store i16 0, i16* @g_56, align 2
store i16 0, ptr @g_56, align 2
br i1 false, label %bb44, label %bb3
bb44: ; preds = %bb44, %bb36
%tmp46 = load i16, i16* @g_56, align 2 ; <i16> [#uses=0]
%tmp46 = load i16, ptr @g_56, align 2 ; <i16> [#uses=0]
br i1 false, label %bb, label %bb44
}
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SimpleLoopUnswitch/2010-11-18-LCSSA.ll
Expand Up @@ -7,7 +7,7 @@ entry:
br i1 true, label %for.end12, label %bb.nph

bb.nph: ; preds = %entry
%g_38.promoted = load i32, i32* @g_38
%g_38.promoted = load i32, ptr @g_38
br label %for.body

for.body: ; preds = %for.cond, %bb.nph
Expand All @@ -20,7 +20,7 @@ for.cond: ; preds = %for.body
br i1 true, label %for.cond.for.end12_crit_edge, label %for.body

for.cond.for.end12_crit_edge: ; preds = %for.cond
store i32 %call1, i32* @g_38
store i32 %call1, ptr @g_38
br label %for.end12

for.end12: ; preds = %for.cond.for.end12_crit_edge, %entry
Expand Down
35 changes: 16 additions & 19 deletions llvm/test/Transforms/SimpleLoopUnswitch/2011-09-26-EHCrash.ll
Expand Up @@ -3,10 +3,10 @@
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.2"

%class.MyContainer.1.3.19.29 = type { [6 x %class.MyMemVarClass.0.2.18.28*] }
%class.MyContainer.1.3.19.29 = type { [6 x ptr] }
%class.MyMemVarClass.0.2.18.28 = type { i32 }

define void @_ZN11MyContainer1fEi(%class.MyContainer.1.3.19.29* %this, i32 %doit) uwtable ssp align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
define void @_ZN11MyContainer1fEi(ptr %this, i32 %doit) uwtable ssp align 2 personality ptr @__gxx_personality_v0 {
entry:
br label %for.cond

Expand All @@ -22,31 +22,28 @@ for.body: ; preds = %for.cond

if.then: ; preds = %for.body
%idxprom = sext i32 %inc1 to i64
%array_ = getelementptr inbounds %class.MyContainer.1.3.19.29, %class.MyContainer.1.3.19.29* %this, i32 0, i32 0
%arrayidx = getelementptr inbounds [6 x %class.MyMemVarClass.0.2.18.28*], [6 x %class.MyMemVarClass.0.2.18.28*]* %array_, i32 0, i64 %idxprom
%tmp4 = load %class.MyMemVarClass.0.2.18.28*, %class.MyMemVarClass.0.2.18.28** %arrayidx, align 8
%isnull = icmp eq %class.MyMemVarClass.0.2.18.28* %tmp4, null
%arrayidx = getelementptr inbounds [6 x ptr], ptr %this, i32 0, i64 %idxprom
%tmp4 = load ptr, ptr %arrayidx, align 8
%isnull = icmp eq ptr %tmp4, null
br i1 %isnull, label %for.inc, label %delete.notnull

delete.notnull: ; preds = %if.then
invoke void @_ZN13MyMemVarClassD1Ev(%class.MyMemVarClass.0.2.18.28* %tmp4)
invoke void @_ZN13MyMemVarClassD1Ev(ptr %tmp4)
to label %invoke.cont unwind label %lpad

invoke.cont: ; preds = %delete.notnull
%0 = bitcast %class.MyMemVarClass.0.2.18.28* %tmp4 to i8*
call void @_ZdlPv(i8* %0) nounwind
call void @_ZdlPv(ptr %tmp4) nounwind
br label %for.inc

lpad: ; preds = %delete.notnull
%1 = landingpad { i8*, i32 }
%0 = landingpad { ptr, i32 }
cleanup
%2 = extractvalue { i8*, i32 } %1, 0
%3 = extractvalue { i8*, i32 } %1, 1
%4 = bitcast %class.MyMemVarClass.0.2.18.28* %tmp4 to i8*
call void @_ZdlPv(i8* %4) nounwind
%lpad.val = insertvalue { i8*, i32 } undef, i8* %2, 0
%lpad.val7 = insertvalue { i8*, i32 } %lpad.val, i32 %3, 1
resume { i8*, i32 } %lpad.val7
%1 = extractvalue { ptr, i32 } %0, 0
%2 = extractvalue { ptr, i32 } %0, 1
call void @_ZdlPv(ptr %tmp4) nounwind
%lpad.val = insertvalue { ptr, i32 } undef, ptr %1, 0
%lpad.val7 = insertvalue { ptr, i32 } %lpad.val, i32 %2, 1
resume { ptr, i32 } %lpad.val7

for.inc: ; preds = %invoke.cont, %if.then, %for.body
%inc = add nsw i32 %inc1, 1
Expand All @@ -56,8 +53,8 @@ for.end: ; preds = %for.cond
ret void
}

declare void @_ZN13MyMemVarClassD1Ev(%class.MyMemVarClass.0.2.18.28*)
declare void @_ZN13MyMemVarClassD1Ev(ptr)

declare i32 @__gxx_personality_v0(...)

declare void @_ZdlPv(i8*) nounwind
declare void @_ZdlPv(ptr) nounwind
Expand Up @@ -8,7 +8,7 @@
; CHECK-NEXT: br label %"16"

; CHECK: "16": ; preds = %"22", %"5"
; CHECK-NEXT: indirectbr i8* undef, [label %"22", label %"33"]
; CHECK-NEXT: indirectbr ptr undef, [label %"22", label %"33"]

; CHECK: "22": ; preds = %"16"
; CHECK-NEXT: br i1 %0, label %"16", label %"26"
Expand All @@ -28,7 +28,7 @@ entry:
br label %"16"

"16": ; preds = %"22", %"5"
indirectbr i8* undef, [label %"22", label %"33"]
indirectbr ptr undef, [label %"22", label %"33"]

"22": ; preds = %"16"
br i1 %0, label %"16", label %"26"
Expand Down

0 comments on commit 2f79f54

Please sign in to comment.