issue #114 Prepare for implementing fast C calls; the Lua typecode is extended to 16 bits to allow more type variants to be added. The intention is that for light C functions, we can encode return type / parameter types to enable calling some C functions directly without having to go through the Lua api.

pull/167/head
Dibyendu Majumdar 6 years ago
parent 5c17bca34e
commit 4676f220a4

@ -35,7 +35,7 @@ BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 80
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4

@ -2,5 +2,5 @@ mkdir llvm64d
cd llvm64d
rem cmake -DCMAKE_INSTALL_PREFIX=c:\ravi64llvmd -G "Visual Studio 14 Win64" -DLLVM_JIT=ON -DLLVM_DIR=c:\LLVM37debug\share\llvm\cmake ..
rem cmake -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=c:\d\ravi64llvmd -G "Visual Studio 15 2017 Win64" -DLLVM_JIT=ON -DEMBEDDED_DMRC=ON -DLLVM_DIR=c:\d\LLVM39D64\lib\cmake\llvm ..
cmake -DCMAKE_INSTALL_PREFIX=c:\Software\ravi -G "Visual Studio 15 2017 Win64" -DLTESTS=ON -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DLLVM_JIT=ON -DLLVM_DIR=c:\Software\llvm501d\lib\cmake\llvm ..
cmake -DCMAKE_INSTALL_PREFIX=c:\Software\ravi -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Debug -DLLVM_JIT=ON -DLLVM_DIR=c:\Software\llvm501d\lib\cmake\llvm ..
cd ..

@ -1,73 +1,121 @@
; ModuleID = 'inline_getstr.c'
source_filename = "inline_getstr.c"
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"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.Table = type { %struct.GCObject*, i8, i8, i8, i8, i32, %struct.TValue*, %struct.Node*, %struct.Node*, %struct.Table*, %struct.GCObject*, %struct.RaviArray, i32 }
%struct.Node = type { %struct.TValue, %union.TKey }
%union.TKey = type { %struct.anon.1 }
%struct.anon.1 = type { %union.Value, i32, i32 }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.RaviArray = type { i8*, i32, i32, i32 }
%struct.anon.1 = type { %union.Value, i16, i32 }
%struct.RaviArray = type { i8*, i32, i32, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.2 }
%union.anon.2 = type { i64 }
; Function Attrs: nounwind
define %struct.TValue* @ravi_getstr(%struct.Table* %t, %struct.TString* %key) local_unnamed_addr #0 {
entry:
%hash = getelementptr inbounds %struct.TString, %struct.TString* %key, i32 0, i32 5
%0 = load i32, i32* %hash, align 8, !tbaa !1
%hmask = getelementptr inbounds %struct.Table, %struct.Table* %t, i32 0, i32 12
%1 = load i32, i32* %hmask, align 4, !tbaa !7
%and = and i32 %1, %0
%node = getelementptr inbounds %struct.Table, %struct.Table* %t, i32 0, i32 7
%2 = load %struct.Node*, %struct.Node** %node, align 4, !tbaa !10
%3 = getelementptr inbounds %struct.Node, %struct.Node* %2, i32 %and, i32 1, i32 0, i32 1
%4 = load i32, i32* %3, align 8, !tbaa !11
%cmp = icmp eq i32 %4, 68
br i1 %cmp, label %land.lhs.true, label %if.end
define %struct.TValue* @ravi_getstr(%struct.Table* %t, %struct.TString* %key) #0 {
%retval = alloca %struct.TValue*, align 8
%key.addr = alloca %struct.TString*, align 8
%t.addr = alloca %struct.Table*, align 8
%n = alloca %struct.Node*, align 8
%k = alloca %struct.TValue*, align 8
%cleanup.dest.slot = alloca i32
store %struct.TString* %key, %struct.TString** %key.addr, align 8, !tbaa !2
store %struct.Table* %t, %struct.Table** %t.addr, align 8, !tbaa !2
%1 = bitcast %struct.Node** %n to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = load %struct.Table*, %struct.Table** %t.addr, align 8, !tbaa !2
%node = getelementptr inbounds %struct.Table, %struct.Table* %2, i32 0, i32 7
%3 = load %struct.Node*, %struct.Node** %node, align 8, !tbaa !6
%4 = load %struct.TString*, %struct.TString** %key.addr, align 8, !tbaa !2
%hash = getelementptr inbounds %struct.TString, %struct.TString* %4, i32 0, i32 5
%5 = load i32, i32* %hash, align 4, !tbaa !10
%6 = load %struct.Table*, %struct.Table** %t.addr, align 8, !tbaa !2
%hmask = getelementptr inbounds %struct.Table, %struct.Table* %6, i32 0, i32 12
%7 = load i32, i32* %hmask, align 8, !tbaa !12
%and = and i32 %5, %7
%idxprom = zext i32 %and to i64
%arrayidx = getelementptr inbounds %struct.Node, %struct.Node* %3, i64 %idxprom
store %struct.Node* %arrayidx, %struct.Node** %n, align 8, !tbaa !2
%8 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %8) #3
%9 = load %struct.Node*, %struct.Node** %n, align 8, !tbaa !2
%i_key = getelementptr inbounds %struct.Node, %struct.Node* %9, i32 0, i32 1
%tvk = bitcast %union.TKey* %i_key to %struct.TValue*
store %struct.TValue* %tvk, %struct.TValue** %k, align 8, !tbaa !2
%10 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%tt_ = getelementptr inbounds %struct.TValue, %struct.TValue* %10, i32 0, i32 1
%11 = load i16, i16* %tt_, align 8, !tbaa !13
%conv = zext i16 %11 to i32
%cmp = icmp eq i32 %conv, 32772
br i1 %cmp, label %12, label %19
land.lhs.true: ; preds = %entry
%value_ = getelementptr inbounds %struct.Node, %struct.Node* %2, i32 %and, i32 1, i32 0, i32 0
%5 = bitcast %union.Value* %value_ to %struct.TString**
%6 = load %struct.TString*, %struct.TString** %5, align 8, !tbaa !13
%cmp1 = icmp eq %struct.TString* %6, %key
br i1 %cmp1, label %if.then, label %if.end
; <label>:12: ; preds = %0
%13 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %13, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%14 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !16
%15 = bitcast %struct.GCObject* %14 to %struct.TString*
%16 = load %struct.TString*, %struct.TString** %key.addr, align 8, !tbaa !2
%cmp2 = icmp eq %struct.TString* %15, %16
br i1 %cmp2, label %17, label %19
if.then: ; preds = %land.lhs.true
%i_val = getelementptr inbounds %struct.Node, %struct.Node* %2, i32 %and, i32 0
br label %cleanup
; <label>:17: ; preds = %12
%18 = load %struct.Node*, %struct.Node** %n, align 8, !tbaa !2
%i_val = getelementptr inbounds %struct.Node, %struct.Node* %18, i32 0, i32 0
store %struct.TValue* %i_val, %struct.TValue** %retval, align 8
store i32 1, i32* %cleanup.dest.slot, align 4
br label %22
if.end: ; preds = %land.lhs.true, %entry
%call = tail call %struct.TValue* @luaH_getstr(%struct.Table* nonnull %t, %struct.TString* nonnull %key) #2
br label %cleanup
; <label>:19: ; preds = %12, %0
%20 = load %struct.TString*, %struct.TString** %key.addr, align 8, !tbaa !2
%21 = load %struct.Table*, %struct.Table** %t.addr, align 8, !tbaa !2
%call = call %struct.TValue* @luaH_getstr(%struct.Table* %21, %struct.TString* %20)
store %struct.TValue* %call, %struct.TValue** %retval, align 8
store i32 1, i32* %cleanup.dest.slot, align 4
br label %22
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi %struct.TValue* [ %i_val, %if.then ], [ %call, %if.end ]
ret %struct.TValue* %retval.0
; <label>:22: ; preds = %19, %17
%23 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %23) #3
%24 = bitcast %struct.Node** %n to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %24) #3
%25 = load %struct.TValue*, %struct.TValue** %retval, align 8
ret %struct.TValue* %25
}
declare %struct.TValue* @luaH_getstr(%struct.Table*, %struct.TString*) local_unnamed_addr #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare %struct.TValue* @luaH_getstr(%struct.Table*, %struct.TString*) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{!"clang version 3.9.0 (trunk)"}
!1 = !{!2, !6, i64 8}
!2 = !{!"TString", !3, i64 0, !4, i64 4, !4, i64 5, !4, i64 6, !4, i64 7, !6, i64 8, !4, i64 16}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!"int", !4, i64 0}
!7 = !{!8, !6, i64 48}
!8 = !{!"Table", !3, i64 0, !4, i64 4, !4, i64 5, !4, i64 6, !4, i64 7, !6, i64 8, !3, i64 12, !3, i64 16, !3, i64 20, !3, i64 24, !3, i64 28, !9, i64 32, !6, i64 48}
!9 = !{!"RaviArray", !3, i64 0, !4, i64 4, !6, i64 8, !6, i64 12}
!10 = !{!8, !3, i64 16}
!11 = !{!12, !6, i64 8}
!12 = !{!"TValue", !4, i64 0, !6, i64 8}
!13 = !{!3, !3, i64 0}
!6 = !{!7, !3, i64 24}
!7 = !{!"Table", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !8, i64 12, !3, i64 16, !3, i64 24, !3, i64 32, !3, i64 40, !3, i64 48, !9, i64 56, !8, i64 80}
!8 = !{!"int", !4, i64 0}
!9 = !{!"RaviArray", !3, i64 0, !8, i64 8, !8, i64 12, !4, i64 16, !4, i64 17}
!10 = !{!11, !8, i64 12}
!11 = !{!"TString", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !8, i64 12, !4, i64 16}
!12 = !{!7, !8, i64 80}
!13 = !{!14, !15, i64 8}
!14 = !{!"TValue", !4, i64 0, !15, i64 8}
!15 = !{!"short", !4, i64 0}
!16 = !{!4, !4, i64 0}

File diff suppressed because it is too large Load Diff

@ -9,6 +9,7 @@ typedef int (*lua_CFunction) (struct lua_State *L);
typedef long long lua_Integer;
typedef unsigned long long lua_Unsigned;
typedef double lua_Number;
typedef unsigned short LuaType;
typedef unsigned long long size_t;
typedef unsigned int Instruction;
typedef long long ptrdiff_t;
@ -36,7 +37,7 @@ union Value {
struct TValue {
union Value value_;
lu_byte tt_;
LuaType tt_;
};
struct TString {
@ -69,7 +70,7 @@ struct Udata {
struct GCObject *next;
lu_byte tt;
lu_byte marked;
lu_byte ttuv_; /* user value's tag */
LuaType ttuv_; /* user value's tag */
struct Table *metatable;
size_t len; /* number of bytes */
union Value user_; /* user value */
@ -110,9 +111,11 @@ struct LocVar {
};
struct RaviJITProto {
lu_byte jit_status; // 0=not compiled, 1=can't compile, 2=compiled, 3=freed
lu_byte jit_status; /* 0=not compiled, 1=can't compile */
lu_byte jit_flags;
unsigned short execution_count; /* how many times has function been executed */
void *jit_data;
int (*jit_function) (struct lua_State *);
lua_CFunction jit_function;
};
@ -174,7 +177,7 @@ union Closure {
union TKey {
struct {
union Value value_;
int tt_;
LuaType tt_;
int next; /* for chaining (offset for next node) */
} nk;
struct TValue tvk;
@ -187,9 +190,10 @@ struct Node {
struct RaviArray {
char *data;
enum ravitype_t type; /* RAVI specialization */
unsigned int len; /* RAVI len specialization */
unsigned int size; /* amount of memory allocated */
lu_byte array_type; /* RAVI specialization */
lu_byte array_modifier; /* Flags that affect how the array is handled */
};
@ -252,8 +256,10 @@ struct CallInfo {
} u;
ptrdiff_t extra;
short nresults; /* expected number of results from this function */
lu_byte callstatus;
lu_byte jitstatus;
unsigned short callstatus;
unsigned short stacklevel; /* RAVI extension - stack level, bottom level is 0 */
lu_byte jitstatus; /* RAVI extension: Only valid if Lua function - if 1 means JITed - RAVI extension */
lu_byte magic;
};
struct CallInfoLua {
@ -263,9 +269,10 @@ struct CallInfoLua {
struct CallInfoL l;
ptrdiff_t extra;
short nresults; /* expected number of results from this function */
lu_byte callstatus;
lu_byte jitstatus; /* Only valid if Lua function - if 1 means JITed - RAVI extension */
short stacklevel; /* Ravi extension - stack level, bootom level is 0 */
unsigned short callstatus;
unsigned short stacklevel; /* RAVI extension - stack level, bottom level is 0 */
lu_byte jitstatus; /* RAVI extension: Only valid if Lua function - if 1 means JITed - RAVI extension */
lu_byte magic;
};
struct global_State;
@ -300,6 +307,7 @@ struct lua_State {
lu_byte hookmask; /* Lua 5.3 uses l_signalT */
lu_byte allowhook;
unsigned short nci; /* number of items in 'ci' list (different position than Lua 5.3) */
lu_byte magic;
};
/* lfunc.h */
@ -330,7 +338,7 @@ union GCUnion {
#define rttype(o) ((o)->tt_)
#define BIT_ISCOLLECTABLE (1 << 7)
#define BIT_ISCOLLECTABLE (1 << 15)
#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE)
#define upisopen(up) ((up)->v != &(up)->u.value)

@ -1,40 +1,43 @@
; ModuleID = 'lua_if_else.c'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_if_else.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, i32, i32, i32 }
%struct.Upvaldesc = type { %struct.TString*, i32, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i32, i64, %struct.TString* }
%struct.RaviJITProto = type { i8, i8*, i32 (%struct.lua_State*)* }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
@.str = private unnamed_addr constant [12 x i8] c"value = %d\0A\00", align 1
$"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = comdat any
@"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = linkonce_odr unnamed_addr constant [12 x i8] c"value = %d\0A\00", comdat, align 1
; Function Attrs: nounwind
define void @testfunc(%struct.GCObject* %obj) #0 {
entry:
%obj.addr = alloca %struct.GCObject*, align 4
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 4, !tbaa !1
%0 = load %struct.GCObject** %obj.addr, align 4, !tbaa !1
%tt = getelementptr inbounds %struct.GCObject* %0, i32 0, i32 1
%1 = load i8* %tt, align 1, !tbaa !5
%conv = zext i8 %1 to i32
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 %conv)
%obj.addr = alloca %struct.GCObject*, align 8
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%1 = load %struct.GCObject*, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%tt = getelementptr inbounds %struct.GCObject, %struct.GCObject* %1, i32 0, i32 1
%2 = load i8, i8* %tt, align 8, !tbaa !6
%conv = zext i8 %2 to i32
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@", i32 0, i32 0), i32 %conv)
ret void
}
@ -42,365 +45,452 @@ declare i32 @printf(i8*, ...) #1
; Function Attrs: nounwind
define void @test1(%struct.lua_State* %L) #0 {
entry:
%L.addr = alloca %struct.lua_State*, align 4
%ci = alloca %struct.CallInfoLua*, align 4
%cl = alloca %struct.LClosure*, align 4
%k = alloca %struct.TValue*, align 4
%base = alloca %struct.TValue*, align 4
%cil = alloca %struct.CallInfoL*, align 4
%ra2 = alloca %struct.TValue*, align 4
%rb2 = alloca %struct.TValue*, align 4
%ra3 = alloca %struct.TValue*, align 4
%L.addr = alloca %struct.lua_State*, align 8
%ci = alloca %struct.CallInfoLua*, align 8
%cl = alloca %struct.LClosure*, align 8
%k = alloca %struct.TValue*, align 8
%base = alloca %struct.TValue*, align 8
%cil = alloca %struct.CallInfoL*, align 8
%ra2 = alloca %struct.TValue*, align 8
%rb2 = alloca %struct.TValue*, align 8
%ra3 = alloca %struct.TValue*, align 8
%b = alloca i32, align 4
%ra = alloca %struct.TValue*, align 4
%rb = alloca %struct.TValue*, align 4
%rc = alloca %struct.TValue*, align 4
%ra = alloca %struct.TValue*, align 8
%rb = alloca %struct.TValue*, align 8
%rc = alloca %struct.TValue*, align 8
%eq = alloca i32, align 4
%a = alloca i32, align 4
%a39 = alloca i32, align 4
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 4, !tbaa !1
%0 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%ci1 = getelementptr inbounds %struct.lua_State* %0, i32 0, i32 6
%1 = load %struct.CallInfoLua** %ci1, align 4, !tbaa !7
store %struct.CallInfoLua* %1, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%2 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l = getelementptr inbounds %struct.CallInfoLua* %2, i32 0, i32 4
%base2 = getelementptr inbounds %struct.CallInfoL* %l, i32 0, i32 0
%3 = load %struct.TValue** %base2, align 4, !tbaa !13
store %struct.TValue* %3, %struct.TValue** %base, align 4, !tbaa !1
%4 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%func = getelementptr inbounds %struct.CallInfoLua* %4, i32 0, i32 0
%5 = load %struct.TValue** %func, align 4, !tbaa !16
%value_ = getelementptr inbounds %struct.TValue* %5, i32 0, i32 0
%cleanup.dest.slot = alloca i32
%a33 = alloca i32, align 4
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !2
%1 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #3
%3 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %3) #3
%4 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %4) #3
%5 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %5) #3
%6 = bitcast %struct.TValue** %ra2 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %6) #3
%7 = bitcast %struct.TValue** %rb2 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %7) #3
%8 = bitcast %struct.TValue** %ra3 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %8) #3
%9 = bitcast i32* %b to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %9) #3
%10 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %10, i32 0, i32 6
%11 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 8, !tbaa !8
store %struct.CallInfoLua* %11, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%12 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %12, i32 0, i32 4
%base2 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l, i32 0, i32 0
%13 = load %struct.TValue*, %struct.TValue** %base2, align 8, !tbaa !14
store %struct.TValue* %13, %struct.TValue** %base, align 8, !tbaa !2
%14 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%func = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %14, i32 0, i32 0
%15 = load %struct.TValue*, %struct.TValue** %func, align 8, !tbaa !17
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %15, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%6 = load %struct.GCObject** %gc, align 4, !tbaa !1
%7 = bitcast %struct.GCObject* %6 to %struct.LClosure*
store %struct.LClosure* %7, %struct.LClosure** %cl, align 4, !tbaa !1
%8 = load %struct.LClosure** %cl, align 4, !tbaa !1
%p = getelementptr inbounds %struct.LClosure* %8, i32 0, i32 5
%9 = load %struct.Proto** %p, align 4, !tbaa !17
%k3 = getelementptr inbounds %struct.Proto* %9, i32 0, i32 14
%10 = load %struct.TValue** %k3, align 4, !tbaa !19
store %struct.TValue* %10, %struct.TValue** %k, align 4, !tbaa !1
%11 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr = getelementptr inbounds %struct.TValue* %11, i32 0
store %struct.TValue* %add.ptr, %struct.TValue** %ra, align 4, !tbaa !1
%12 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr4 = getelementptr inbounds %struct.TValue* %12, i32 0
store %struct.TValue* %add.ptr4, %struct.TValue** %rb, align 4, !tbaa !1
%13 = load %struct.TValue** %k, align 4, !tbaa !1
%add.ptr5 = getelementptr inbounds %struct.TValue* %13, i32 0
store %struct.TValue* %add.ptr5, %struct.TValue** %rc, align 4, !tbaa !1
%14 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%15 = load %struct.TValue** %rb, align 4, !tbaa !1
%16 = load %struct.TValue** %rc, align 4, !tbaa !1
%call = call i32 bitcast (i32 (...)* @luaV_equalobj to i32 (%struct.lua_State*, %struct.TValue*, %struct.TValue*)*)(%struct.lua_State* %14, %struct.TValue* %15, %struct.TValue* %16)
store i32 %call, i32* %eq, align 4, !tbaa !22
%17 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l6 = getelementptr inbounds %struct.CallInfoLua* %17, i32 0, i32 4
%base7 = getelementptr inbounds %struct.CallInfoL* %l6, i32 0, i32 0
%18 = load %struct.TValue** %base7, align 4, !tbaa !13
store %struct.TValue* %18, %struct.TValue** %base, align 4, !tbaa !1
%19 = load i32* %eq, align 4, !tbaa !22
%cmp = icmp eq i32 %19, 0
br i1 %cmp, label %if.then, label %if.end15
if.then: ; preds = %entry
store i32 0, i32* %a, align 4, !tbaa !22
%20 = load i32* %a, align 4, !tbaa !22
%cmp8 = icmp sgt i32 %20, 0
br i1 %cmp8, label %if.then9, label %if.end
if.then9: ; preds = %if.then
%21 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%22 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l10 = getelementptr inbounds %struct.CallInfoLua* %22, i32 0, i32 4
%base11 = getelementptr inbounds %struct.CallInfoL* %l10, i32 0, i32 0
%23 = load %struct.TValue** %base11, align 4, !tbaa !13
%24 = load i32* %a, align 4, !tbaa !22
%add.ptr12 = getelementptr inbounds %struct.TValue* %23, i32 %24
%add.ptr13 = getelementptr inbounds %struct.TValue* %add.ptr12, i32 -1
%call14 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %21, %struct.TValue* %add.ptr13)
br label %if.end
if.end: ; preds = %if.then9, %if.then
br label %label6
if.end15: ; preds = %entry
br label %label3
label3: ; preds = %if.end15
%25 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr16 = getelementptr inbounds %struct.TValue* %25, i32 1
store %struct.TValue* %add.ptr16, %struct.TValue** %ra2, align 4, !tbaa !1
%26 = load %struct.TValue** %k, align 4, !tbaa !1
%add.ptr17 = getelementptr inbounds %struct.TValue* %26, i32 1
store %struct.TValue* %add.ptr17, %struct.TValue** %rb2, align 4, !tbaa !1
%27 = load %struct.TValue** %ra2, align 4, !tbaa !1
%28 = load %struct.TValue** %rb2, align 4, !tbaa !1
%29 = bitcast %struct.TValue* %27 to i8*
%30 = bitcast %struct.TValue* %28 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %29, i8* %30, i32 16, i32 8, i1 false), !tbaa.struct !23
store i32 2, i32* %b, align 4, !tbaa !22
%31 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr18 = getelementptr inbounds %struct.TValue* %31, i32 1
store %struct.TValue* %add.ptr18, %struct.TValue** %ra3, align 4, !tbaa !1
%32 = load %struct.TValue** %ra3, align 4, !tbaa !1
%33 = load i32* %b, align 4, !tbaa !22
%add.ptr19 = getelementptr inbounds %struct.TValue* %32, i32 %33
%add.ptr20 = getelementptr inbounds %struct.TValue* %add.ptr19, i32 -1
%34 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top = getelementptr inbounds %struct.lua_State* %34, i32 0, i32 4
store %struct.TValue* %add.ptr20, %struct.TValue** %top, align 4, !tbaa !27
%35 = load %struct.LClosure** %cl, align 4, !tbaa !1
%p21 = getelementptr inbounds %struct.LClosure* %35, i32 0, i32 5
%36 = load %struct.Proto** %p21, align 4, !tbaa !17
%sizep = getelementptr inbounds %struct.Proto* %36, i32 0, i32 10
%37 = load i32* %sizep, align 4, !tbaa !28
%cmp22 = icmp sgt i32 %37, 0
br i1 %cmp22, label %if.then23, label %if.end25
if.then23: ; preds = %label3
%38 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%39 = load %struct.TValue** %base, align 4, !tbaa !1
%call24 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %38, %struct.TValue* %39)
br label %if.end25
if.end25: ; preds = %if.then23, %label3
%40 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%41 = load %struct.TValue** %ra3, align 4, !tbaa !1
%call26 = call i32 @luaD_poscall(%struct.lua_State* %40, %struct.TValue* %41)
store i32 %call26, i32* %b, align 4, !tbaa !22
%42 = load i32* %b, align 4, !tbaa !22
%tobool = icmp ne i32 %42, 0
br i1 %tobool, label %if.then27, label %if.end30
if.then27: ; preds = %if.end25
%43 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%top28 = getelementptr inbounds %struct.CallInfoLua* %43, i32 0, i32 1
%44 = load %struct.TValue** %top28, align 4, !tbaa !29
%45 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top29 = getelementptr inbounds %struct.lua_State* %45, i32 0, i32 4
store %struct.TValue* %44, %struct.TValue** %top29, align 4, !tbaa !27
br label %if.end30
if.end30: ; preds = %if.then27, %if.end25
br label %return
label6: ; preds = %if.end
%46 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr31 = getelementptr inbounds %struct.TValue* %46, i32 0
store %struct.TValue* %add.ptr31, %struct.TValue** %ra, align 4, !tbaa !1
%47 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr32 = getelementptr inbounds %struct.TValue* %47, i32 0
store %struct.TValue* %add.ptr32, %struct.TValue** %rb, align 4, !tbaa !1
%48 = load %struct.TValue** %k, align 4, !tbaa !1
%add.ptr33 = getelementptr inbounds %struct.TValue* %48, i32 2
store %struct.TValue* %add.ptr33, %struct.TValue** %rc, align 4, !tbaa !1
%49 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%50 = load %struct.TValue** %rb, align 4, !tbaa !1
%51 = load %struct.TValue** %rc, align 4, !tbaa !1
%call34 = call i32 bitcast (i32 (...)* @luaV_equalobj to i32 (%struct.lua_State*, %struct.TValue*, %struct.TValue*)*)(%struct.lua_State* %49, %struct.TValue* %50, %struct.TValue* %51)
store i32 %call34, i32* %eq, align 4, !tbaa !22
%52 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l35 = getelementptr inbounds %struct.CallInfoLua* %52, i32 0, i32 4
%base36 = getelementptr inbounds %struct.CallInfoL* %l35, i32 0, i32 0
%53 = load %struct.TValue** %base36, align 4, !tbaa !13
store %struct.TValue* %53, %struct.TValue** %base, align 4, !tbaa !1
%54 = load i32* %eq, align 4, !tbaa !22
%cmp37 = icmp eq i32 %54, 0
br i1 %cmp37, label %if.then38, label %if.end48
if.then38: ; preds = %label6
store i32 0, i32* %a39, align 4, !tbaa !22
%55 = load i32* %a39, align 4, !tbaa !22
%cmp40 = icmp sgt i32 %55, 0
br i1 %cmp40, label %if.then41, label %if.end47
if.then41: ; preds = %if.then38
%56 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%57 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l42 = getelementptr inbounds %struct.CallInfoLua* %57, i32 0, i32 4
%base43 = getelementptr inbounds %struct.CallInfoL* %l42, i32 0, i32 0
%58 = load %struct.TValue** %base43, align 4, !tbaa !13
%59 = load i32* %a39, align 4, !tbaa !22
%add.ptr44 = getelementptr inbounds %struct.TValue* %58, i32 %59
%add.ptr45 = getelementptr inbounds %struct.TValue* %add.ptr44, i32 -1
%call46 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %56, %struct.TValue* %add.ptr45)
br label %if.end47
if.end47: ; preds = %if.then41, %if.then38
br label %label11
if.end48: ; preds = %label6
br label %label8
label8: ; preds = %if.end48
%60 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr49 = getelementptr inbounds %struct.TValue* %60, i32 1
store %struct.TValue* %add.ptr49, %struct.TValue** %ra2, align 4, !tbaa !1
%61 = load %struct.TValue** %k, align 4, !tbaa !1
%add.ptr50 = getelementptr inbounds %struct.TValue* %61, i32 3
store %struct.TValue* %add.ptr50, %struct.TValue** %rb2, align 4, !tbaa !1
%62 = load %struct.TValue** %ra2, align 4, !tbaa !1
%63 = load %struct.TValue** %rb2, align 4, !tbaa !1
%64 = bitcast %struct.TValue* %62 to i8*
%65 = bitcast %struct.TValue* %63 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %64, i8* %65, i32 16, i32 8, i1 false), !tbaa.struct !23
store i32 2, i32* %b, align 4, !tbaa !22
%66 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr51 = getelementptr inbounds %struct.TValue* %66, i32 1
store %struct.TValue* %add.ptr51, %struct.TValue** %ra3, align 4, !tbaa !1
%67 = load %struct.TValue** %ra3, align 4, !tbaa !1
%68 = load i32* %b, align 4, !tbaa !22
%add.ptr52 = getelementptr inbounds %struct.TValue* %67, i32 %68
%add.ptr53 = getelementptr inbounds %struct.TValue* %add.ptr52, i32 -1
%69 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top54 = getelementptr inbounds %struct.lua_State* %69, i32 0, i32 4
store %struct.TValue* %add.ptr53, %struct.TValue** %top54, align 4, !tbaa !27
%70 = load %struct.LClosure** %cl, align 4, !tbaa !1
%p55 = getelementptr inbounds %struct.LClosure* %70, i32 0, i32 5
%71 = load %struct.Proto** %p55, align 4, !tbaa !17
%sizep56 = getelementptr inbounds %struct.Proto* %71, i32 0, i32 10
%72 = load i32* %sizep56, align 4, !tbaa !28
%cmp57 = icmp sgt i32 %72, 0
br i1 %cmp57, label %if.then58, label %if.end60
if.then58: ; preds = %label8
%73 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%74 = load %struct.TValue** %base, align 4, !tbaa !1
%call59 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %73, %struct.TValue* %74)
br label %if.end60
if.end60: ; preds = %if.then58, %label8
%75 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%76 = load %struct.TValue** %ra3, align 4, !tbaa !1
%call61 = call i32 @luaD_poscall(%struct.lua_State* %75, %struct.TValue* %76)
store i32 %call61, i32* %b, align 4, !tbaa !22
%77 = load i32* %b, align 4, !tbaa !22
%tobool62 = icmp ne i32 %77, 0
br i1 %tobool62, label %if.then63, label %if.end66
if.then63: ; preds = %if.end60
%78 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%top64 = getelementptr inbounds %struct.CallInfoLua* %78, i32 0, i32 1
%79 = load %struct.TValue** %top64, align 4, !tbaa !29
%80 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top65 = getelementptr inbounds %struct.lua_State* %80, i32 0, i32 4
store %struct.TValue* %79, %struct.TValue** %top65, align 4, !tbaa !27
br label %if.end66
if.end66: ; preds = %if.then63, %if.end60
br label %return
label11: ; preds = %if.end47
%81 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr67 = getelementptr inbounds %struct.TValue* %81, i32 1
store %struct.TValue* %add.ptr67, %struct.TValue** %ra2, align 4, !tbaa !1
%82 = load %struct.TValue** %k, align 4, !tbaa !1
%add.ptr68 = getelementptr inbounds %struct.TValue* %82, i32 4
store %struct.TValue* %add.ptr68, %struct.TValue** %rb2, align 4, !tbaa !1
%83 = load %struct.TValue** %ra2, align 4, !tbaa !1
%84 = load %struct.TValue** %rb2, align 4, !tbaa !1
%85 = bitcast %struct.TValue* %83 to i8*
%86 = bitcast %struct.TValue* %84 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %85, i8* %86, i32 16, i32 8, i1 false), !tbaa.struct !23
store i32 2, i32* %b, align 4, !tbaa !22
%87 = load %struct.TValue** %base, align 4, !tbaa !1
%add.ptr69 = getelementptr inbounds %struct.TValue* %87, i32 1
store %struct.TValue* %add.ptr69, %struct.TValue** %ra3, align 4, !tbaa !1
%88 = load %struct.TValue** %ra3, align 4, !tbaa !1
%89 = load i32* %b, align 4, !tbaa !22
%add.ptr70 = getelementptr inbounds %struct.TValue* %88, i32 %89
%add.ptr71 = getelementptr inbounds %struct.TValue* %add.ptr70, i32 -1
%90 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top72 = getelementptr inbounds %struct.lua_State* %90, i32 0, i32 4
store %struct.TValue* %add.ptr71, %struct.TValue** %top72, align 4, !tbaa !27
%91 = load %struct.LClosure** %cl, align 4, !tbaa !1
%p73 = getelementptr inbounds %struct.LClosure* %91, i32 0, i32 5
%92 = load %struct.Proto** %p73, align 4, !tbaa !17
%sizep74 = getelementptr inbounds %struct.Proto* %92, i32 0, i32 10
%93 = load i32* %sizep74, align 4, !tbaa !28
%cmp75 = icmp sgt i32 %93, 0
br i1 %cmp75, label %if.then76, label %if.end78
if.then76: ; preds = %label11
%94 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%95 = load %struct.TValue** %base, align 4, !tbaa !1
%call77 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %94, %struct.TValue* %95)
br label %if.end78
if.end78: ; preds = %if.then76, %label11
%96 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%97 = load %struct.TValue** %ra3, align 4, !tbaa !1
%call79 = call i32 @luaD_poscall(%struct.lua_State* %96, %struct.TValue* %97)
store i32 %call79, i32* %b, align 4, !tbaa !22
%98 = load i32* %b, align 4, !tbaa !22
%tobool80 = icmp ne i32 %98, 0
br i1 %tobool80, label %if.then81, label %if.end84
if.then81: ; preds = %if.end78
%99 = load %struct.CallInfoLua** %ci, align 4, !tbaa !1
%top82 = getelementptr inbounds %struct.CallInfoLua* %99, i32 0, i32 1
%100 = load %struct.TValue** %top82, align 4, !tbaa !29
%101 = load %struct.lua_State** %L.addr, align 4, !tbaa !1
%top83 = getelementptr inbounds %struct.lua_State* %101, i32 0, i32 4
store %struct.TValue* %100, %struct.TValue** %top83, align 4, !tbaa !27
br label %if.end84
if.end84: ; preds = %if.then81, %if.end78
br label %return
label_return: ; No predecessors!
br label %return
return: ; preds = %label_return, %if.end84, %if.end66, %if.end30
%16 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !18
%17 = bitcast %struct.GCObject* %16 to %struct.LClosure*
store %struct.LClosure* %17, %struct.LClosure** %cl, align 8, !tbaa !2
%18 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p = getelementptr inbounds %struct.LClosure, %struct.LClosure* %18, i32 0, i32 5
%19 = load %struct.Proto*, %struct.Proto** %p, align 8, !tbaa !19
%k3 = getelementptr inbounds %struct.Proto, %struct.Proto* %19, i32 0, i32 14
%20 = load %struct.TValue*, %struct.TValue** %k3, align 8, !tbaa !21
store %struct.TValue* %20, %struct.TValue** %k, align 8, !tbaa !2
%21 = bitcast %struct.TValue** %ra to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %21) #3
%22 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr = getelementptr inbounds %struct.TValue, %struct.TValue* %22, i64 0
store %struct.TValue* %add.ptr, %struct.TValue** %ra, align 8, !tbaa !2
%23 = bitcast %struct.TValue** %rb to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %23) #3
%24 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr4 = getelementptr inbounds %struct.TValue, %struct.TValue* %24, i64 0
store %struct.TValue* %add.ptr4, %struct.TValue** %rb, align 8, !tbaa !2
%25 = bitcast %struct.TValue** %rc to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %25) #3
%26 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%add.ptr5 = getelementptr inbounds %struct.TValue, %struct.TValue* %26, i64 0
store %struct.TValue* %add.ptr5, %struct.TValue** %rc, align 8, !tbaa !2
%27 = bitcast i32* %eq to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %27) #3
%28 = load %struct.TValue*, %struct.TValue** %rc, align 8, !tbaa !2
%29 = load %struct.TValue*, %struct.TValue** %rb, align 8, !tbaa !2
%30 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call = call i32 bitcast (i32 (...)* @luaV_equalobj to i32 (%struct.lua_State*, %struct.TValue*, %struct.TValue*)*)(%struct.lua_State* %30, %struct.TValue* %29, %struct.TValue* %28)
store i32 %call, i32* %eq, align 4, !tbaa !24
%31 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l6 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %31, i32 0, i32 4
%base7 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l6, i32 0, i32 0
%32 = load %struct.TValue*, %struct.TValue** %base7, align 8, !tbaa !14
store %struct.TValue* %32, %struct.TValue** %base, align 8, !tbaa !2
%33 = load i32, i32* %eq, align 4, !tbaa !24
%cmp = icmp eq i32 %33, 0
br i1 %cmp, label %34, label %44
; <label>:34: ; preds = %0
%35 = bitcast i32* %a to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %35) #3
store i32 0, i32* %a, align 4, !tbaa !24
%36 = load i32, i32* %a, align 4, !tbaa !24
%cmp8 = icmp sgt i32 %36, 0
br i1 %cmp8, label %37, label %42
; <label>:37: ; preds = %34
%38 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l9 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %38, i32 0, i32 4
%base10 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l9, i32 0, i32 0
%39 = load %struct.TValue*, %struct.TValue** %base10, align 8, !tbaa !14
%40 = load i32, i32* %a, align 4, !tbaa !24
%idx.ext = sext i32 %40 to i64
%add.ptr11 = getelementptr inbounds %struct.TValue, %struct.TValue* %39, i64 %idx.ext
%add.ptr12 = getelementptr inbounds %struct.TValue, %struct.TValue* %add.ptr11, i64 -1
%41 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call13 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %41, %struct.TValue* %add.ptr12)
br label %42
; <label>:42: ; preds = %37, %34
store i32 2, i32* %cleanup.dest.slot, align 4
%43 = bitcast i32* %a to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %43) #3
%cleanup.dest = load i32, i32* %cleanup.dest.slot, align 4
switch i32 %cleanup.dest, label %145 [
i32 2, label %71
]
; <label>:44: ; preds = %0
br label %45
; <label>:45: ; preds = %44
%46 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr14 = getelementptr inbounds %struct.TValue, %struct.TValue* %46, i64 1
store %struct.TValue* %add.ptr14, %struct.TValue** %ra2, align 8, !tbaa !2
%47 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%add.ptr15 = getelementptr inbounds %struct.TValue, %struct.TValue* %47, i64 1
store %struct.TValue* %add.ptr15, %struct.TValue** %rb2, align 8, !tbaa !2
%48 = load %struct.TValue*, %struct.TValue** %ra2, align 8, !tbaa !2
%49 = load %struct.TValue*, %struct.TValue** %rb2, align 8, !tbaa !2
%50 = bitcast %struct.TValue* %48 to i8*
%51 = bitcast %struct.TValue* %49 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %50, i8* %51, i64 16, i32 8, i1 false), !tbaa.struct !25
store i32 2, i32* %b, align 4, !tbaa !24
%52 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr16 = getelementptr inbounds %struct.TValue, %struct.TValue* %52, i64 1
store %struct.TValue* %add.ptr16, %struct.TValue** %ra3, align 8, !tbaa !2
%53 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%54 = load i32, i32* %b, align 4, !tbaa !24
%idx.ext17 = sext i32 %54 to i64
%add.ptr18 = getelementptr inbounds %struct.TValue, %struct.TValue* %53, i64 %idx.ext17
%add.ptr19 = getelementptr inbounds %struct.TValue, %struct.TValue* %add.ptr18, i64 -1
%55 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top = getelementptr inbounds %struct.lua_State, %struct.lua_State* %55, i32 0, i32 4
store %struct.TValue* %add.ptr19, %struct.TValue** %top, align 8, !tbaa !30
%56 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p20 = getelementptr inbounds %struct.LClosure, %struct.LClosure* %56, i32 0, i32 5
%57 = load %struct.Proto*, %struct.Proto** %p20, align 8, !tbaa !19
%sizep = getelementptr inbounds %struct.Proto, %struct.Proto* %57, i32 0, i32 10
%58 = load i32, i32* %sizep, align 8, !tbaa !31
%cmp21 = icmp sgt i32 %58, 0
br i1 %cmp21, label %59, label %62
; <label>:59: ; preds = %45
%60 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%61 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call22 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %61, %struct.TValue* %60)
br label %62
; <label>:62: ; preds = %59, %45
%63 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%64 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call23 = call i32 @luaD_poscall(%struct.lua_State* %64, %struct.TValue* %63)
store i32 %call23, i32* %b, align 4, !tbaa !24
%65 = load i32, i32* %b, align 4, !tbaa !24
%tobool = icmp ne i32 %65, 0
br i1 %tobool, label %66, label %70
; <label>:66: ; preds = %62
%67 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%top24 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %67, i32 0, i32 1
%68 = load %struct.TValue*, %struct.TValue** %top24, align 8, !tbaa !32
%69 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top25 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %69, i32 0, i32 4
store %struct.TValue* %68, %struct.TValue** %top25, align 8, !tbaa !30
br label %70
; <label>:70: ; preds = %66, %62
store i32 1, i32* %cleanup.dest.slot, align 4
br label %145
; <label>:71: ; preds = %42
%72 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr26 = getelementptr inbounds %struct.TValue, %struct.TValue* %72, i64 0
store %struct.TValue* %add.ptr26, %struct.TValue** %ra, align 8, !tbaa !2
%73 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr27 = getelementptr inbounds %struct.TValue, %struct.TValue* %73, i64 0
store %struct.TValue* %add.ptr27, %struct.TValue** %rb, align 8, !tbaa !2
%74 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%add.ptr28 = getelementptr inbounds %struct.TValue, %struct.TValue* %74, i64 2
store %struct.TValue* %add.ptr28, %struct.TValue** %rc, align 8, !tbaa !2
%75 = load %struct.TValue*, %struct.TValue** %rc, align 8, !tbaa !2
%76 = load %struct.TValue*, %struct.TValue** %rb, align 8, !tbaa !2
%77 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call29 = call i32 bitcast (i32 (...)* @luaV_equalobj to i32 (%struct.lua_State*, %struct.TValue*, %struct.TValue*)*)(%struct.lua_State* %77, %struct.TValue* %76, %struct.TValue* %75)
store i32 %call29, i32* %eq, align 4, !tbaa !24
%78 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l30 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %78, i32 0, i32 4
%base31 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l30, i32 0, i32 0
%79 = load %struct.TValue*, %struct.TValue** %base31, align 8, !tbaa !14
store %struct.TValue* %79, %struct.TValue** %base, align 8, !tbaa !2
%80 = load i32, i32* %eq, align 4, !tbaa !24
%cmp32 = icmp eq i32 %80, 0
br i1 %cmp32, label %81, label %91
; <label>:81: ; preds = %71
%82 = bitcast i32* %a33 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %82) #3
store i32 0, i32* %a33, align 4, !tbaa !24
%83 = load i32, i32* %a33, align 4, !tbaa !24
%cmp34 = icmp sgt i32 %83, 0
br i1 %cmp34, label %84, label %89
; <label>:84: ; preds = %81
%85 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l35 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %85, i32 0, i32 4
%base36 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l35, i32 0, i32 0
%86 = load %struct.TValue*, %struct.TValue** %base36, align 8, !tbaa !14
%87 = load i32, i32* %a33, align 4, !tbaa !24
%idx.ext37 = sext i32 %87 to i64
%add.ptr38 = getelementptr inbounds %struct.TValue, %struct.TValue* %86, i64 %idx.ext37
%add.ptr39 = getelementptr inbounds %struct.TValue, %struct.TValue* %add.ptr38, i64 -1
%88 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call40 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %88, %struct.TValue* %add.ptr39)
br label %89
; <label>:89: ; preds = %84, %81
store i32 5, i32* %cleanup.dest.slot, align 4
%90 = bitcast i32* %a33 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %90) #3
%cleanup.dest56 = load i32, i32* %cleanup.dest.slot, align 4
switch i32 %cleanup.dest56, label %145 [
i32 5, label %118
]
; <label>:91: ; preds = %71
br label %92
; <label>:92: ; preds = %91
%93 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr41 = getelementptr inbounds %struct.TValue, %struct.TValue* %93, i64 1
store %struct.TValue* %add.ptr41, %struct.TValue** %ra2, align 8, !tbaa !2
%94 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%add.ptr42 = getelementptr inbounds %struct.TValue, %struct.TValue* %94, i64 3
store %struct.TValue* %add.ptr42, %struct.TValue** %rb2, align 8, !tbaa !2
%95 = load %struct.TValue*, %struct.TValue** %ra2, align 8, !tbaa !2
%96 = load %struct.TValue*, %struct.TValue** %rb2, align 8, !tbaa !2
%97 = bitcast %struct.TValue* %95 to i8*
%98 = bitcast %struct.TValue* %96 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %97, i8* %98, i64 16, i32 8, i1 false), !tbaa.struct !25
store i32 2, i32* %b, align 4, !tbaa !24
%99 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr43 = getelementptr inbounds %struct.TValue, %struct.TValue* %99, i64 1
store %struct.TValue* %add.ptr43, %struct.TValue** %ra3, align 8, !tbaa !2
%100 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%101 = load i32, i32* %b, align 4, !tbaa !24
%idx.ext44 = sext i32 %101 to i64
%add.ptr45 = getelementptr inbounds %struct.TValue, %struct.TValue* %100, i64 %idx.ext44
%add.ptr46 = getelementptr inbounds %struct.TValue, %struct.TValue* %add.ptr45, i64 -1
%102 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top47 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %102, i32 0, i32 4
store %struct.TValue* %add.ptr46, %struct.TValue** %top47, align 8, !tbaa !30
%103 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p48 = getelementptr inbounds %struct.LClosure, %struct.LClosure* %103, i32 0, i32 5
%104 = load %struct.Proto*, %struct.Proto** %p48, align 8, !tbaa !19
%sizep49 = getelementptr inbounds %struct.Proto, %struct.Proto* %104, i32 0, i32 10
%105 = load i32, i32* %sizep49, align 8, !tbaa !31
%cmp50 = icmp sgt i32 %105, 0
br i1 %cmp50, label %106, label %109
; <label>:106: ; preds = %92
%107 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%108 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call51 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %108, %struct.TValue* %107)
br label %109
; <label>:109: ; preds = %106, %92
%110 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%111 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call52 = call i32 @luaD_poscall(%struct.lua_State* %111, %struct.TValue* %110)
store i32 %call52, i32* %b, align 4, !tbaa !24
%112 = load i32, i32* %b, align 4, !tbaa !24
%tobool53 = icmp ne i32 %112, 0
br i1 %tobool53, label %113, label %117
; <label>:113: ; preds = %109
%114 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%top54 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %114, i32 0, i32 1
%115 = load %struct.TValue*, %struct.TValue** %top54, align 8, !tbaa !32
%116 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top55 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %116, i32 0, i32 4
store %struct.TValue* %115, %struct.TValue** %top55, align 8, !tbaa !30
br label %117
; <label>:117: ; preds = %113, %109
store i32 1, i32* %cleanup.dest.slot, align 4
br label %145
; <label>:118: ; preds = %89
%119 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr57 = getelementptr inbounds %struct.TValue, %struct.TValue* %119, i64 1
store %struct.TValue* %add.ptr57, %struct.TValue** %ra2, align 8, !tbaa !2
%120 = load %struct.TValue*, %struct.TValue** %k, align 8, !tbaa !2
%add.ptr58 = getelementptr inbounds %struct.TValue, %struct.TValue* %120, i64 4
store %struct.TValue* %add.ptr58, %struct.TValue** %rb2, align 8, !tbaa !2
%121 = load %struct.TValue*, %struct.TValue** %ra2, align 8, !tbaa !2
%122 = load %struct.TValue*, %struct.TValue** %rb2, align 8, !tbaa !2
%123 = bitcast %struct.TValue* %121 to i8*
%124 = bitcast %struct.TValue* %122 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %123, i8* %124, i64 16, i32 8, i1 false), !tbaa.struct !25
store i32 2, i32* %b, align 4, !tbaa !24
%125 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%add.ptr59 = getelementptr inbounds %struct.TValue, %struct.TValue* %125, i64 1
store %struct.TValue* %add.ptr59, %struct.TValue** %ra3, align 8, !tbaa !2
%126 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%127 = load i32, i32* %b, align 4, !tbaa !24
%idx.ext60 = sext i32 %127 to i64
%add.ptr61 = getelementptr inbounds %struct.TValue, %struct.TValue* %126, i64 %idx.ext60
%add.ptr62 = getelementptr inbounds %struct.TValue, %struct.TValue* %add.ptr61, i64 -1
%128 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top63 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %128, i32 0, i32 4
store %struct.TValue* %add.ptr62, %struct.TValue** %top63, align 8, !tbaa !30
%129 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p64 = getelementptr inbounds %struct.LClosure, %struct.LClosure* %129, i32 0, i32 5
%130 = load %struct.Proto*, %struct.Proto** %p64, align 8, !tbaa !19
%sizep65 = getelementptr inbounds %struct.Proto, %struct.Proto* %130, i32 0, i32 10
%131 = load i32, i32* %sizep65, align 8, !tbaa !31
%cmp66 = icmp sgt i32 %131, 0
br i1 %cmp66, label %132, label %135
; <label>:132: ; preds = %118
%133 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%134 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call67 = call i32 bitcast (i32 (...)* @luaF_close to i32 (%struct.lua_State*, %struct.TValue*)*)(%struct.lua_State* %134, %struct.TValue* %133)
br label %135
; <label>:135: ; preds = %132, %118
%136 = load %struct.TValue*, %struct.TValue** %ra3, align 8, !tbaa !2
%137 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call68 = call i32 @luaD_poscall(%struct.lua_State* %137, %struct.TValue* %136)
store i32 %call68, i32* %b, align 4, !tbaa !24
%138 = load i32, i32* %b, align 4, !tbaa !24
%tobool69 = icmp ne i32 %138, 0
br i1 %tobool69, label %139, label %143
; <label>:139: ; preds = %135
%140 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%top70 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %140, i32 0, i32 1
%141 = load %struct.TValue*, %struct.TValue** %top70, align 8, !tbaa !32
%142 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%top71 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %142, i32 0, i32 4
store %struct.TValue* %141, %struct.TValue** %top71, align 8, !tbaa !30
br label %143
; <label>:143: ; preds = %139, %135
store i32 1, i32* %cleanup.dest.slot, align 4
br label %145
; No predecessors!
store i32 1, i32* %cleanup.dest.slot, align 4
br label %145
; <label>:145: ; preds = %144, %143, %89, %117, %42, %70
%146 = bitcast i32* %eq to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %146) #3
%147 = bitcast %struct.TValue** %rc to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %147) #3
%148 = bitcast %struct.TValue** %rb to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %148) #3
%149 = bitcast %struct.TValue** %ra to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %149) #3
%150 = bitcast i32* %b to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %150) #3
%151 = bitcast %struct.TValue** %ra3 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %151) #3
%152 = bitcast %struct.TValue** %rb2 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %152) #3
%153 = bitcast %struct.TValue** %ra2 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %153) #3
%154 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %154) #3
%155 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %155) #3
%156 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %156) #3
%157 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %157) #3
%158 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %158) #3
ret void
}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
declare i32 @luaV_equalobj(...) #1
declare i32 @luaF_close(...) #1
; Function Attrs: nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) #2
declare i32 @luaD_poscall(%struct.lua_State*, %struct.TValue*) #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
!llvm.ident = !{!0}
!0 = metadata !{metadata !"clang version 3.6.0 (trunk)"}
!1 = metadata !{metadata !2, metadata !2, i64 0}
!2 = metadata !{metadata !"any pointer", metadata !3, i64 0}
!3 = metadata !{metadata !"omnipotent char", metadata !4, i64 0}
!4 = metadata !{metadata !"Simple C/C++ TBAA"}
!5 = metadata !{metadata !6, metadata !3, i64 4}
!6 = metadata !{metadata !"GCObject", metadata !2, i64 0, metadata !3, i64 4, metadata !3, i64 5}
!7 = metadata !{metadata !8, metadata !2, i64 16}
!8 = metadata !{metadata !"lua_State", metadata !2, i64 0, metadata !3, i64 4, metadata !3, i64 5, metadata !3, i64 6, metadata !2, i64 8, metadata !2, i64 12, metadata !2, i64 16, metadata !2, i64 20, metadata !2, i64 24, metadata !2, i64 28, metadata !2, i64 32, metadata !2, i64 36, metadata !2, i64 40, metadata !2, i64 44, metadata !9, i64 48, metadata !2, i64 104, metadata !10, i64 112, metadata !12, i64 120, metadata !12, i64 124, metadata !12, i64 128, metadata !11, i64 132, metadata !11, i64 134, metadata !3, i64 136, metadata !3, i64 137}
!9 = metadata !{metadata !"CallInfo", metadata !2, i64 0, metadata !2, i64 4, metadata !2, i64 8, metadata !2, i64 12, metadata !3, i64 16, metadata !10, i64 40, metadata !11, i64 48, metadata !3, i64 50, metadata !3, i64 51}
!10 = metadata !{metadata !"long long", metadata !3, i64 0}
!11 = metadata !{metadata !"short", metadata !3, i64 0}
!12 = metadata !{metadata !"int", metadata !3, i64 0}
!13 = metadata !{metadata !14, metadata !2, i64 16}
!14 = metadata !{metadata !"CallInfoLua", metadata !2, i64 0, metadata !2, i64 4, metadata !2, i64 8, metadata !2, i64 12, metadata !15, i64 16, metadata !10, i64 32, metadata !11, i64 40, metadata !3, i64 42, metadata !3, i64 43}
!15 = metadata !{metadata !"CallInfoL", metadata !2, i64 0, metadata !2, i64 4, metadata !10, i64 8}
!16 = metadata !{metadata !14, metadata !2, i64 0}
!17 = metadata !{metadata !18, metadata !2, i64 12}
!18 = metadata !{metadata !"LClosure", metadata !2, i64 0, metadata !3, i64 4, metadata !3, i64 5, metadata !3, i64 6, metadata !2, i64 8, metadata !2, i64 12, metadata !3, i64 16}
!19 = metadata !{metadata !20, metadata !2, i64 44}
!20 = metadata !{metadata !"Proto", metadata !2, i64 0, metadata !3, i64 4, metadata !3, i64 5, metadata !3, i64 6, metadata !3, i64 7, metadata !3, i64 8, metadata !12, i64 12, metadata !12, i64 16, metadata !12, i64 20, metadata !12, i64 24, metadata !12, i64 28, metadata !12, i64 32, metadata !12, i64 36, metadata !12, i64 40, metadata !2, i64 44, metadata !2, i64 48, metadata !2, i64 52, metadata !2, i64 56, metadata !2, i64 60, metadata !2, i64 64, metadata !2, i64 68, metadata !2, i64 72, metadata !2, i64 76, metadata !21, i64 80}
!21 = metadata !{metadata !"RaviJITProto", metadata !3, i64 0, metadata !2, i64 4, metadata !2, i64 8}
!22 = metadata !{metadata !12, metadata !12, i64 0}
!23 = metadata !{i64 0, i64 4, metadata !1, i64 0, i64 4, metadata !1, i64 0, i64 4, metadata !22, i64 0, i64 4, metadata !1, i64 0, i64 8, metadata !24, i64 0, i64 8, metadata !25, i64 8, i64 4, metadata !22}
!24 = metadata !{metadata !10, metadata !10, i64 0}
!25 = metadata !{metadata !26, metadata !26, i64 0}
!26 = metadata !{metadata !"double", metadata !3, i64 0}
!27 = metadata !{metadata !8, metadata !2, i64 8}
!28 = metadata !{metadata !20, metadata !12, i64 28}
!29 = metadata !{metadata !14, metadata !2, i64 4}
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !4, i64 8}
!7 = !{!"GCObject", !3, i64 0, !4, i64 8, !4, i64 9}
!8 = !{!9, !3, i64 32}
!9 = !{!"lua_State", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !3, i64 32, !3, i64 40, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !10, i64 96, !3, i64 168, !11, i64 176, !13, i64 184, !13, i64 188, !13, i64 192, !12, i64 196, !12, i64 198, !4, i64 200, !4, i64 201, !12, i64 202, !4, i64 204}
!10 = !{!"CallInfo", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !4, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!11 = !{!"long long", !4, i64 0}
!12 = !{!"short", !4, i64 0}
!13 = !{!"int", !4, i64 0}
!14 = !{!15, !3, i64 32}
!15 = !{!"CallInfoLua", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !16, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!16 = !{!"CallInfoL", !3, i64 0, !3, i64 8, !11, i64 16}
!17 = !{!15, !3, i64 0}
!18 = !{!4, !4, i64 0}
!19 = !{!20, !3, i64 24}
!20 = !{!"LClosure", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !4, i64 32}
!21 = !{!22, !3, i64 48}
!22 = !{!"Proto", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !4, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !3, i64 96, !3, i64 104, !3, i64 112, !23, i64 120}
!23 = !{!"RaviJITProto", !4, i64 0, !4, i64 1, !12, i64 2, !3, i64 8, !3, i64 16}
!24 = !{!13, !13, i64 0}
!25 = !{i64 0, i64 8, !2, i64 0, i64 8, !2, i64 0, i64 4, !24, i64 0, i64 8, !2, i64 0, i64 8, !26, i64 0, i64 8, !27, i64 8, i64 2, !29}
!26 = !{!11, !11, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !4, i64 0}
!29 = !{!12, !12, i64 0}
!30 = !{!9, !3, i64 16}
!31 = !{!22, !13, i64 32}
!32 = !{!15, !3, i64 8}

@ -1,79 +1,132 @@
; ModuleID = 'lua_op_call.c'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_op_call.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
; Function Attrs: nounwind
define void @luaV_op_call(%struct.lua_State* %L, %struct.CallInfo* nocapture readonly %ci, %struct.TValue* %ra, i32 %b, i32 %c) #0 {
entry:
%sub = add nsw i32 %c, -1
%cmp = icmp eq i32 %b, 0
br i1 %cmp, label %if.end, label %if.then
if.then: ; preds = %entry
%add.ptr = getelementptr inbounds %struct.TValue* %ra, i32 %b
%top = getelementptr inbounds %struct.lua_State* %L, i32 0, i32 4
store %struct.TValue* %add.ptr, %struct.TValue** %top, align 4, !tbaa !1
br label %if.end
if.end: ; preds = %entry, %if.then
%call = tail call i32 @luaD_precall(%struct.lua_State* %L, %struct.TValue* %ra, i32 %sub, i32 1) #2
%tobool = icmp eq i32 %call, 0
br i1 %tobool, label %if.else, label %if.then1
if.then1: ; preds = %if.end
%cmp2 = icmp eq i32 %call, 1
%cmp3 = icmp sgt i32 %c, 0
%or.cond = and i1 %cmp3, %cmp2
br i1 %or.cond, label %if.then4, label %if.end8
if.then4: ; preds = %if.then1
%top5 = getelementptr inbounds %struct.CallInfo* %ci, i32 0, i32 1
%0 = load %struct.TValue** %top5, align 4, !tbaa !10
%top6 = getelementptr inbounds %struct.lua_State* %L, i32 0, i32 4
store %struct.TValue* %0, %struct.TValue** %top6, align 4, !tbaa !1
br label %if.end8
if.else: ; preds = %if.end
tail call void @luaV_execute(%struct.lua_State* %L) #2
br label %if.end8
if.end8: ; preds = %if.then1, %if.then4, %if.else
define void @luaV_op_call(%struct.lua_State* %L, %struct.CallInfo* %ci, %struct.TValue* %ra, i32 %b, i32 %c) #0 {
%c.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%ra.addr = alloca %struct.TValue*, align 8
%ci.addr = alloca %struct.CallInfo*, align 8
%L.addr = alloca %struct.lua_State*, align 8
%nresults = alloca i32, align 4
%c_or_compiled = alloca i32, align 4
store i32 %c, i32* %c.addr, align 4, !tbaa !2
store i32 %b, i32* %b.addr, align 4, !tbaa !2
store %struct.TValue* %ra, %struct.TValue** %ra.addr, align 8, !tbaa !6
store %struct.CallInfo* %ci, %struct.CallInfo** %ci.addr, align 8, !tbaa !6
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !6
%1 = bitcast i32* %nresults to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #3
%2 = load i32, i32* %c.addr, align 4, !tbaa !2
%sub = sub nsw i32 %2, 1
store i32 %sub, i32* %nresults, align 4, !tbaa !2
%3 = load i32, i32* %b.addr, align 4, !tbaa !2
%cmp = icmp ne i32 %3, 0
br i1 %cmp, label %4, label %8
; <label>:4: ; preds = %0
%5 = load %struct.TValue*, %struct.TValue** %ra.addr, align 8, !tbaa !6
%6 = load i32, i32* %b.addr, align 4, !tbaa !2
%idx.ext = sext i32 %6 to i64
%add.ptr = getelementptr inbounds %struct.TValue, %struct.TValue* %5, i64 %idx.ext
%7 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%top = getelementptr inbounds %struct.lua_State, %struct.lua_State* %7, i32 0, i32 4
store %struct.TValue* %add.ptr, %struct.TValue** %top, align 8, !tbaa !8
br label %8
; <label>:8: ; preds = %4, %0
%9 = bitcast i32* %c_or_compiled to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %9) #3
%10 = load i32, i32* %nresults, align 4, !tbaa !2
%11 = load %struct.TValue*, %struct.TValue** %ra.addr, align 8, !tbaa !6
%12 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%call = call i32 @luaD_precall(%struct.lua_State* %12, %struct.TValue* %11, i32 %10, i32 1)
store i32 %call, i32* %c_or_compiled, align 4, !tbaa !2
%13 = load i32, i32* %c_or_compiled, align 4, !tbaa !2
%tobool = icmp ne i32 %13, 0
br i1 %tobool, label %14, label %23
; <label>:14: ; preds = %8
%15 = load i32, i32* %c_or_compiled, align 4, !tbaa !2
%cmp1 = icmp eq i32 %15, 1
br i1 %cmp1, label %16, label %22
; <label>:16: ; preds = %14
%17 = load i32, i32* %nresults, align 4, !tbaa !2
%cmp2 = icmp sge i32 %17, 0
br i1 %cmp2, label %18, label %22
; <label>:18: ; preds = %16
%19 = load %struct.CallInfo*, %struct.CallInfo** %ci.addr, align 8, !tbaa !6
%top3 = getelementptr inbounds %struct.CallInfo, %struct.CallInfo* %19, i32 0, i32 1
%20 = load %struct.TValue*, %struct.TValue** %top3, align 8, !tbaa !13
%21 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%top4 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %21, i32 0, i32 4
store %struct.TValue* %20, %struct.TValue** %top4, align 8, !tbaa !8
br label %22
; <label>:22: ; preds = %18, %16, %14
br label %25
; <label>:23: ; preds = %8
%24 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
call void @luaV_execute(%struct.lua_State* %24)
br label %25
; <label>:25: ; preds = %23, %22
%26 = bitcast i32* %c_or_compiled to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %26) #3
%27 = bitcast i32* %nresults to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %27) #3
ret void
}
declare i32 @luaD_precall(%struct.lua_State*, %struct.TValue*, i32, i32) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare i32 @luaD_precall(%struct.lua_State*, %struct.TValue*, i32, i32) #2
declare void @luaV_execute(%struct.lua_State*) #2
declare void @luaV_execute(%struct.lua_State*) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = metadata !{metadata !"clang version 3.6.0 (trunk)"}
!1 = metadata !{metadata !2, metadata !3, i64 8}
!2 = metadata !{metadata !"lua_State", metadata !3, i64 0, metadata !4, i64 4, metadata !4, i64 5, metadata !4, i64 6, metadata !3, i64 8, metadata !3, i64 12, metadata !3, i64 16, metadata !3, i64 20, metadata !3, i64 24, metadata !3, i64 28, metadata !3, i64 32, metadata !3, i64 36, metadata !3, i64 40, metadata !3, i64 44, metadata !6, i64 48, metadata !3, i64 104, metadata !7, i64 112, metadata !9, i64 120, metadata !9, i64 124, metadata !9, i64 128, metadata !8, i64 132, metadata !8, i64 134, metadata !4, i64 136, metadata !4, i64 137}
!3 = metadata !{metadata !"any pointer", metadata !4, i64 0}
!4 = metadata !{metadata !"omnipotent char", metadata !5, i64 0}
!5 = metadata !{metadata !"Simple C/C++ TBAA"}
!6 = metadata !{metadata !"CallInfo", metadata !3, i64 0, metadata !3, i64 4, metadata !3, i64 8, metadata !3, i64 12, metadata !4, i64 16, metadata !7, i64 40, metadata !8, i64 48, metadata !4, i64 50, metadata !4, i64 51}
!7 = metadata !{metadata !"long long", metadata !4, i64 0}
!8 = metadata !{metadata !"short", metadata !4, i64 0}
!9 = metadata !{metadata !"int", metadata !4, i64 0}
!10 = metadata !{metadata !6, metadata !3, i64 4}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"int", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !4, i64 0}
!8 = !{!9, !7, i64 16}
!9 = !{!"lua_State", !7, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !7, i64 168, !11, i64 176, !3, i64 184, !3, i64 188, !3, i64 192, !12, i64 196, !12, i64 198, !4, i64 200, !4, i64 201, !12, i64 202, !4, i64 204}
!10 = !{!"CallInfo", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !4, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!11 = !{!"long long", !4, i64 0}
!12 = !{!"short", !4, i64 0}
!13 = !{!10, !7, i64 8}

@ -1,142 +1,399 @@
; ModuleID = 'lua_op_forloop.c'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_op_forloop.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
@.str = private unnamed_addr constant [12 x i8] c"value = %d\0A\00", align 1
@.str1 = private unnamed_addr constant [6 x i8] c"dummy\00", align 1
$"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = comdat any
$"\01??_C@_05JLNEMJLN@dummy?$AA@" = comdat any
@"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = linkonce_odr unnamed_addr constant [12 x i8] c"value = %d\0A\00", comdat, align 1
@"\01??_C@_05JLNEMJLN@dummy?$AA@" = linkonce_odr unnamed_addr constant [6 x i8] c"dummy\00", comdat, align 1
; Function Attrs: nounwind
define void @testfunc(%struct.GCObject* nocapture readonly %obj) #0 {
entry:
%tt = getelementptr inbounds %struct.GCObject* %obj, i32 0, i32 1
%0 = load i8* %tt, align 1, !tbaa !1
%conv = zext i8 %0 to i32
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 %conv) #1
define void @testfunc(%struct.GCObject* %obj) #0 {
%obj.addr = alloca %struct.GCObject*, align 8
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%1 = load %struct.GCObject*, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%tt = getelementptr inbounds %struct.GCObject, %struct.GCObject* %1, i32 0, i32 1
%2 = load i8, i8* %tt, align 8, !tbaa !6
%conv = zext i8 %2 to i32
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@", i32 0, i32 0), i32 %conv)
ret void
}
; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...) #0
declare i32 @printf(i8*, ...) #1
; Function Attrs: nounwind
define void @test1(%struct.lua_State* nocapture readonly %L) #0 {
entry:
%ci1 = getelementptr inbounds %struct.lua_State* %L, i32 0, i32 6
%0 = load %struct.CallInfoLua** %ci1, align 4, !tbaa !6
%base2 = getelementptr inbounds %struct.CallInfoLua* %0, i32 0, i32 4, i32 0
%1 = load %struct.TValue** %base2, align 4, !tbaa !12
%add.ptr = getelementptr inbounds %struct.TValue* %1, i32 1
%tt_ = getelementptr inbounds %struct.TValue* %1, i32 1, i32 1
%value_5 = getelementptr inbounds %struct.TValue* %1, i32 3, i32 0
%i = getelementptr inbounds %union.Value* %value_5, i32 0, i32 0
%i7 = getelementptr inbounds %struct.TValue* %add.ptr, i32 0, i32 0, i32 0
%i12 = getelementptr inbounds %struct.TValue* %1, i32 2, i32 0, i32 0
%i23 = getelementptr inbounds %struct.TValue* %1, i32 4, i32 0, i32 0
%tt_24 = getelementptr inbounds %struct.TValue* %1, i32 4, i32 1
%n = bitcast %union.Value* %value_5 to double*
%n31 = bitcast %struct.TValue* %add.ptr to double*
%value_36 = getelementptr inbounds %struct.TValue* %1, i32 2, i32 0
%n37 = bitcast %union.Value* %value_36 to double*
%add.ptr48 = getelementptr inbounds %struct.TValue* %1, i32 4
%n50 = bitcast %struct.TValue* %add.ptr48 to double*
br label %label_loopbody
label_loopbody: ; preds = %label_loopbody.backedge, %entry
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0)) #1
%2 = load i32* %tt_, align 4, !tbaa !15
%cmp = icmp eq i32 %2, 19
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %label_loopbody
%3 = load i64* %i, align 8, !tbaa !17
%4 = load i64* %i7, align 8, !tbaa !17
%add8 = add nsw i64 %4, %3
%5 = load i64* %i12, align 8, !tbaa !17
%cmp13 = icmp sgt i64 %3, 0
br i1 %cmp13, label %cond.true, label %cond.false
cond.true: ; preds = %if.then
%cmp14 = icmp sgt i64 %add8, %5
br i1 %cmp14, label %if.end53, label %if.then16
cond.false: ; preds = %if.then
%cmp15 = icmp sgt i64 %5, %add8
br i1 %cmp15, label %if.end53, label %if.then16
if.then16: ; preds = %cond.true, %cond.false
store i64 %add8, i64* %i7, align 8, !tbaa !17
store i32 19, i32* %tt_, align 4, !tbaa !15
store i64 %add8, i64* %i23, align 8, !tbaa !17
br label %label_loopbody.backedge
label_loopbody.backedge: ; preds = %if.then16, %if.then43
%storemerge = phi i32 [ 3, %if.then43 ], [ 19, %if.then16 ]
store i32 %storemerge, i32* %tt_24, align 4, !tbaa !15
br label %label_loopbody
if.else: ; preds = %label_loopbody
%6 = load double* %n, align 8, !tbaa !18
%7 = load double* %n31, align 8, !tbaa !18
%add32 = fadd double %6, %7
%8 = load double* %n37, align 8, !tbaa !18
%cmp38 = fcmp ogt double %6, 0.000000e+00
br i1 %cmp38, label %cond.true39, label %cond.false41
cond.true39: ; preds = %if.else
%cmp40 = fcmp ugt double %add32, %8
br i1 %cmp40, label %if.end53, label %if.then43
cond.false41: ; preds = %if.else
%cmp42 = fcmp ugt double %8, %add32
br i1 %cmp42, label %if.end53, label %if.then43
if.then43: ; preds = %cond.true39, %cond.false41
store double %add32, double* %n31, align 8, !tbaa !18
store i32 3, i32* %tt_, align 4, !tbaa !15
store double %add32, double* %n50, align 8, !tbaa !18
br label %label_loopbody.backedge
if.end53: ; preds = %cond.true, %cond.false, %cond.true39, %cond.false41
define void @test1(%struct.lua_State* %L) #0 {
%L.addr = alloca %struct.lua_State*, align 8
%ci = alloca %struct.CallInfoLua*, align 8
%cl = alloca %struct.LClosure*, align 8
%k = alloca %struct.TValue*, align 8
%base = alloca %struct.TValue*, align 8
%cil = alloca %struct.CallInfoL*, align 8
%ra = alloca %struct.TValue*, align 8
%rb = alloca %struct.TValue*, align 8
%rc = alloca %struct.TValue*, align 8
%rd = alloca %struct.TValue*, align 8
%A = alloca i32, align 4
%step = alloca i64, align 8
%idx = alloca i64, align 8
%limit = alloca i64, align 8
%cleanup.dest.slot = alloca i32
%step34 = alloca double, align 8
%idx36 = alloca double, align 8
%limit43 = alloca double, align 8
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !2
%1 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #3
%3 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %3) #3
%4 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %4) #3
%5 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %5) #3
%6 = bitcast %struct.TValue** %ra to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %6) #3
%7 = bitcast %struct.TValue** %rb to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %7) #3
%8 = bitcast %struct.TValue** %rc to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %8) #3
%9 = bitcast %struct.TValue** %rd to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %9) #3
%10 = bitcast i32* %A to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %10) #3
%11 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %11, i32 0, i32 6
%12 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 8, !tbaa !8
store %struct.CallInfoLua* %12, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%13 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %13, i32 0, i32 4
%base2 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l, i32 0, i32 0
%14 = load %struct.TValue*, %struct.TValue** %base2, align 8, !tbaa !14
store %struct.TValue* %14, %struct.TValue** %base, align 8, !tbaa !2
%15 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%func = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %15, i32 0, i32 0
%16 = load %struct.TValue*, %struct.TValue** %func, align 8, !tbaa !17
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %16, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%17 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !18
%18 = bitcast %struct.GCObject* %17 to %struct.LClosure*
store %struct.LClosure* %18, %struct.LClosure** %cl, align 8, !tbaa !2
%19 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p = getelementptr inbounds %struct.LClosure, %struct.LClosure* %19, i32 0, i32 5
%20 = load %struct.Proto*, %struct.Proto** %p, align 8, !tbaa !19
%k3 = getelementptr inbounds %struct.Proto, %struct.Proto* %20, i32 0, i32 14
%21 = load %struct.TValue*, %struct.TValue** %k3, align 8, !tbaa !21
store %struct.TValue* %21, %struct.TValue** %k, align 8, !tbaa !2
br label %22
; <label>:22: ; preds = %97, %60, %0
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @"\01??_C@_05JLNEMJLN@dummy?$AA@", i32 0, i32 0))
br label %23
; <label>:23: ; preds = %22
store i32 1, i32* %A, align 4, !tbaa !24
%24 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%25 = load i32, i32* %A, align 4, !tbaa !24
%idx.ext = sext i32 %25 to i64
%add.ptr = getelementptr inbounds %struct.TValue, %struct.TValue* %24, i64 %idx.ext
store %struct.TValue* %add.ptr, %struct.TValue** %ra, align 8, !tbaa !2
%26 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%tt_ = getelementptr inbounds %struct.TValue, %struct.TValue* %26, i32 0, i32 1
%27 = load i16, i16* %tt_, align 8, !tbaa !25
%conv = zext i16 %27 to i32
%cmp = icmp eq i32 %conv, 19
br i1 %cmp, label %28, label %65
; <label>:28: ; preds = %23
%29 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%30 = load i32, i32* %A, align 4, !tbaa !24
%add = add nsw i32 %30, 2
%idx.ext5 = sext i32 %add to i64
%add.ptr6 = getelementptr inbounds %struct.TValue, %struct.TValue* %29, i64 %idx.ext5
store %struct.TValue* %add.ptr6, %struct.TValue** %rb, align 8, !tbaa !2
%31 = bitcast i64* %step to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %31) #3
%32 = load %struct.TValue*, %struct.TValue** %rb, align 8, !tbaa !2
%value_7 = getelementptr inbounds %struct.TValue, %struct.TValue* %32, i32 0, i32 0
%i = bitcast %union.Value* %value_7 to i64*
%33 = load i64, i64* %i, align 8, !tbaa !18
store i64 %33, i64* %step, align 8, !tbaa !27
%34 = bitcast i64* %idx to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %34) #3
%35 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%value_8 = getelementptr inbounds %struct.TValue, %struct.TValue* %35, i32 0, i32 0
%i9 = bitcast %union.Value* %value_8 to i64*
%36 = load i64, i64* %i9, align 8, !tbaa !18
%37 = load i64, i64* %step, align 8, !tbaa !27
%add10 = add nsw i64 %36, %37
store i64 %add10, i64* %idx, align 8, !tbaa !27
%38 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%39 = load i32, i32* %A, align 4, !tbaa !24
%add11 = add nsw i32 %39, 1
%idx.ext12 = sext i32 %add11 to i64
%add.ptr13 = getelementptr inbounds %struct.TValue, %struct.TValue* %38, i64 %idx.ext12
store %struct.TValue* %add.ptr13, %struct.TValue** %rc, align 8, !tbaa !2
%40 = bitcast i64* %limit to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %40) #3
%41 = load %struct.TValue*, %struct.TValue** %rc, align 8, !tbaa !2
%value_14 = getelementptr inbounds %struct.TValue, %struct.TValue* %41, i32 0, i32 0
%i15 = bitcast %union.Value* %value_14 to i64*
%42 = load i64, i64* %i15, align 8, !tbaa !18
store i64 %42, i64* %limit, align 8, !tbaa !27
%43 = load i64, i64* %step, align 8, !tbaa !27
%cmp16 = icmp slt i64 0, %43
br i1 %cmp16, label %44, label %47
; <label>:44: ; preds = %28
%45 = load i64, i64* %idx, align 8, !tbaa !27
%46 = load i64, i64* %limit, align 8, !tbaa !27
%cmp18 = icmp sle i64 %45, %46
br i1 %cmp18, label %50, label %59
; <label>:47: ; preds = %28
%48 = load i64, i64* %limit, align 8, !tbaa !27
%49 = load i64, i64* %idx, align 8, !tbaa !27
%cmp20 = icmp sle i64 %48, %49
br i1 %cmp20, label %50, label %59
; <label>:50: ; preds = %47, %44
%51 = load i64, i64* %idx, align 8, !tbaa !27
%52 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%value_22 = getelementptr inbounds %struct.TValue, %struct.TValue* %52, i32 0, i32 0
%i23 = bitcast %union.Value* %value_22 to i64*
store i64 %51, i64* %i23, align 8, !tbaa !18
%53 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%tt_24 = getelementptr inbounds %struct.TValue, %struct.TValue* %53, i32 0, i32 1
store i16 19, i16* %tt_24, align 8, !tbaa !25
%54 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%55 = load i32, i32* %A, align 4, !tbaa !24
%add25 = add nsw i32 %55, 3
%idx.ext26 = sext i32 %add25 to i64
%add.ptr27 = getelementptr inbounds %struct.TValue, %struct.TValue* %54, i64 %idx.ext26
store %struct.TValue* %add.ptr27, %struct.TValue** %rd, align 8, !tbaa !2
%56 = load i64, i64* %idx, align 8, !tbaa !27
%57 = load %struct.TValue*, %struct.TValue** %rd, align 8, !tbaa !2
%value_28 = getelementptr inbounds %struct.TValue, %struct.TValue* %57, i32 0, i32 0
%i29 = bitcast %union.Value* %value_28 to i64*
store i64 %56, i64* %i29, align 8, !tbaa !18
%58 = load %struct.TValue*, %struct.TValue** %rd, align 8, !tbaa !2
%tt_30 = getelementptr inbounds %struct.TValue, %struct.TValue* %58, i32 0, i32 1
store i16 19, i16* %tt_30, align 8, !tbaa !25
store i32 2, i32* %cleanup.dest.slot, align 4
br label %60
; <label>:59: ; preds = %47, %44
store i32 0, i32* %cleanup.dest.slot, align 4
br label %60
; <label>:60: ; preds = %59, %50
%61 = bitcast i64* %limit to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %61) #3
%62 = bitcast i64* %idx to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %62) #3
%63 = bitcast i64* %step to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %63) #3
%cleanup.dest = load i32, i32* %cleanup.dest.slot, align 4
switch i32 %cleanup.dest, label %113 [
i32 0, label %64
i32 2, label %22
]
; <label>:64: ; preds = %60
br label %102
; <label>:65: ; preds = %23
%66 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%67 = load i32, i32* %A, align 4, !tbaa !24
%add31 = add nsw i32 %67, 2
%idx.ext32 = sext i32 %add31 to i64
%add.ptr33 = getelementptr inbounds %struct.TValue, %struct.TValue* %66, i64 %idx.ext32
store %struct.TValue* %add.ptr33, %struct.TValue** %rb, align 8, !tbaa !2
%68 = bitcast double* %step34 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %68) #3
%69 = load %struct.TValue*, %struct.TValue** %rb, align 8, !tbaa !2
%value_35 = getelementptr inbounds %struct.TValue, %struct.TValue* %69, i32 0, i32 0
%n = bitcast %union.Value* %value_35 to double*
%70 = load double, double* %n, align 8, !tbaa !18
store double %70, double* %step34, align 8, !tbaa !28
%71 = bitcast double* %idx36 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %71) #3
%72 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%value_37 = getelementptr inbounds %struct.TValue, %struct.TValue* %72, i32 0, i32 0
%n38 = bitcast %union.Value* %value_37 to double*
%73 = load double, double* %n38, align 8, !tbaa !18
%74 = load double, double* %step34, align 8, !tbaa !28
%add39 = fadd double %73, %74
store double %add39, double* %idx36, align 8, !tbaa !28
%75 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%76 = load i32, i32* %A, align 4, !tbaa !24
%add40 = add nsw i32 %76, 1
%idx.ext41 = sext i32 %add40 to i64
%add.ptr42 = getelementptr inbounds %struct.TValue, %struct.TValue* %75, i64 %idx.ext41
store %struct.TValue* %add.ptr42, %struct.TValue** %rc, align 8, !tbaa !2
%77 = bitcast double* %limit43 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %77) #3
%78 = load %struct.TValue*, %struct.TValue** %rc, align 8, !tbaa !2
%value_44 = getelementptr inbounds %struct.TValue, %struct.TValue* %78, i32 0, i32 0
%n45 = bitcast %union.Value* %value_44 to double*
%79 = load double, double* %n45, align 8, !tbaa !18
store double %79, double* %limit43, align 8, !tbaa !28
%80 = load double, double* %step34, align 8, !tbaa !28
%cmp46 = fcmp olt double 0.000000e+00, %80
br i1 %cmp46, label %81, label %84
; <label>:81: ; preds = %65
%82 = load double, double* %idx36, align 8, !tbaa !28
%83 = load double, double* %limit43, align 8, !tbaa !28
%cmp48 = fcmp ole double %82, %83
br i1 %cmp48, label %87, label %96
; <label>:84: ; preds = %65
%85 = load double, double* %limit43, align 8, !tbaa !28
%86 = load double, double* %idx36, align 8, !tbaa !28
%cmp50 = fcmp ole double %85, %86
br i1 %cmp50, label %87, label %96
; <label>:87: ; preds = %84, %81
%88 = load double, double* %idx36, align 8, !tbaa !28
%89 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%value_52 = getelementptr inbounds %struct.TValue, %struct.TValue* %89, i32 0, i32 0
%n53 = bitcast %union.Value* %value_52 to double*
store double %88, double* %n53, align 8, !tbaa !18
%90 = load %struct.TValue*, %struct.TValue** %ra, align 8, !tbaa !2
%tt_54 = getelementptr inbounds %struct.TValue, %struct.TValue* %90, i32 0, i32 1
store i16 3, i16* %tt_54, align 8, !tbaa !25
%91 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%92 = load i32, i32* %A, align 4, !tbaa !24
%add55 = add nsw i32 %92, 3
%idx.ext56 = sext i32 %add55 to i64
%add.ptr57 = getelementptr inbounds %struct.TValue, %struct.TValue* %91, i64 %idx.ext56
store %struct.TValue* %add.ptr57, %struct.TValue** %rd, align 8, !tbaa !2
%93 = load double, double* %idx36, align 8, !tbaa !28
%94 = load %struct.TValue*, %struct.TValue** %rd, align 8, !tbaa !2
%value_58 = getelementptr inbounds %struct.TValue, %struct.TValue* %94, i32 0, i32 0
%n59 = bitcast %union.Value* %value_58 to double*
store double %93, double* %n59, align 8, !tbaa !18
%95 = load %struct.TValue*, %struct.TValue** %rd, align 8, !tbaa !2
%tt_60 = getelementptr inbounds %struct.TValue, %struct.TValue* %95, i32 0, i32 1
store i16 3, i16* %tt_60, align 8, !tbaa !25
store i32 2, i32* %cleanup.dest.slot, align 4
br label %97
; <label>:96: ; preds = %84, %81
store i32 0, i32* %cleanup.dest.slot, align 4
br label %97
; <label>:97: ; preds = %96, %87
%98 = bitcast double* %limit43 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %98) #3
%99 = bitcast double* %idx36 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %99) #3
%100 = bitcast double* %step34 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %100) #3
%cleanup.dest61 = load i32, i32* %cleanup.dest.slot, align 4
switch i32 %cleanup.dest61, label %113 [
i32 0, label %101
i32 2, label %22
]
; <label>:101: ; preds = %97
br label %102
; <label>:102: ; preds = %101, %64
%103 = bitcast i32* %A to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %103) #3
%104 = bitcast %struct.TValue** %rd to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %104) #3
%105 = bitcast %struct.TValue** %rc to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %105) #3
%106 = bitcast %struct.TValue** %rb to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %106) #3
%107 = bitcast %struct.TValue** %ra to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %107) #3
%108 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %108) #3
%109 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %109) #3
%110 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %110) #3
%111 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %111) #3
%112 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %112) #3
ret void
; <label>:113: ; preds = %97, %60
unreachable
}
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
!llvm.ident = !{!0}
!0 = metadata !{metadata !"clang version 3.6.0 (trunk)"}
!1 = metadata !{metadata !2, metadata !4, i64 4}
!2 = metadata !{metadata !"GCObject", metadata !3, i64 0, metadata !4, i64 4, metadata !4, i64 5}
!3 = metadata !{metadata !"any pointer", metadata !4, i64 0}
!4 = metadata !{metadata !"omnipotent char", metadata !5, i64 0}
!5 = metadata !{metadata !"Simple C/C++ TBAA"}
!6 = metadata !{metadata !7, metadata !3, i64 16}
!7 = metadata !{metadata !"lua_State", metadata !3, i64 0, metadata !4, i64 4, metadata !4, i64 5, metadata !4, i64 6, metadata !3, i64 8, metadata !3, i64 12, metadata !3, i64 16, metadata !3, i64 20, metadata !3, i64 24, metadata !3, i64 28, metadata !3, i64 32, metadata !3, i64 36, metadata !3, i64 40, metadata !3, i64 44, metadata !8, i64 48, metadata !3, i64 104, metadata !9, i64 112, metadata !11, i64 120, metadata !11, i64 124, metadata !11, i64 128, metadata !10, i64 132, metadata !10, i64 134, metadata !4, i64 136, metadata !4, i64 137}
!8 = metadata !{metadata !"CallInfo", metadata !3, i64 0, metadata !3, i64 4, metadata !3, i64 8, metadata !3, i64 12, metadata !4, i64 16, metadata !9, i64 40, metadata !10, i64 48, metadata !4, i64 50, metadata !4, i64 51}
!9 = metadata !{metadata !"long long", metadata !4, i64 0}
!10 = metadata !{metadata !"short", metadata !4, i64 0}
!11 = metadata !{metadata !"int", metadata !4, i64 0}
!12 = metadata !{metadata !13, metadata !3, i64 16}
!13 = metadata !{metadata !"CallInfoLua", metadata !3, i64 0, metadata !3, i64 4, metadata !3, i64 8, metadata !3, i64 12, metadata !14, i64 16, metadata !9, i64 32, metadata !10, i64 40, metadata !4, i64 42, metadata !4, i64 43}
!14 = metadata !{metadata !"CallInfoL", metadata !3, i64 0, metadata !3, i64 4, metadata !9, i64 8}
!15 = metadata !{metadata !16, metadata !11, i64 8}
!16 = metadata !{metadata !"TValue", metadata !4, i64 0, metadata !11, i64 8}
!17 = metadata !{metadata !9, metadata !9, i64 0}
!18 = metadata !{metadata !19, metadata !19, i64 0}
!19 = metadata !{metadata !"double", metadata !4, i64 0}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !4, i64 8}
!7 = !{!"GCObject", !3, i64 0, !4, i64 8, !4, i64 9}
!8 = !{!9, !3, i64 32}
!9 = !{!"lua_State", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !3, i64 32, !3, i64 40, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !10, i64 96, !3, i64 168, !11, i64 176, !13, i64 184, !13, i64 188, !13, i64 192, !12, i64 196, !12, i64 198, !4, i64 200, !4, i64 201, !12, i64 202, !4, i64 204}
!10 = !{!"CallInfo", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !4, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!11 = !{!"long long", !4, i64 0}
!12 = !{!"short", !4, i64 0}
!13 = !{!"int", !4, i64 0}
!14 = !{!15, !3, i64 32}
!15 = !{!"CallInfoLua", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !16, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!16 = !{!"CallInfoL", !3, i64 0, !3, i64 8, !11, i64 16}
!17 = !{!15, !3, i64 0}
!18 = !{!4, !4, i64 0}
!19 = !{!20, !3, i64 24}
!20 = !{!"LClosure", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !4, i64 32}
!21 = !{!22, !3, i64 48}
!22 = !{!"Proto", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !4, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !3, i64 96, !3, i64 104, !3, i64 112, !23, i64 120}
!23 = !{!"RaviJITProto", !4, i64 0, !4, i64 1, !12, i64 2, !3, i64 8, !3, i64 16}
!24 = !{!13, !13, i64 0}
!25 = !{!26, !12, i64 8}
!26 = !{!"TValue", !4, i64 0, !12, i64 8}
!27 = !{!11, !11, i64 0}
!28 = !{!29, !29, i64 0}
!29 = !{!"double", !4, i64 0}

@ -1,204 +1,458 @@
; ModuleID = 'lua_op_forprep.c'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_op_forprep.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
@.str = private unnamed_addr constant [12 x i8] c"value = %d\0A\00", align 1
@.str1 = private unnamed_addr constant [29 x i8] c"'for' limit must be a number\00", align 1
@.str2 = private unnamed_addr constant [28 x i8] c"'for' step must be a number\00", align 1
@.str3 = private unnamed_addr constant [37 x i8] c"'for' initial value must be a number\00", align 1
$"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = comdat any
$"\01??_C@_0BN@GHPMJMPH@?8for?8?5limit?5must?5be?5a?5number?$AA@" = comdat any
$"\01??_C@_0BM@EGCFKNIJ@?8for?8?5step?5must?5be?5a?5number?$AA@" = comdat any
$"\01??_C@_0CF@JJFDEONC@?8for?8?5initial?5value?5must?5be?5a?5nu@" = comdat any
@"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = linkonce_odr unnamed_addr constant [12 x i8] c"value = %d\0A\00", comdat, align 1
@"\01??_C@_0BN@GHPMJMPH@?8for?8?5limit?5must?5be?5a?5number?$AA@" = linkonce_odr unnamed_addr constant [29 x i8] c"'for' limit must be a number\00", comdat, align 1
@"\01??_C@_0BM@EGCFKNIJ@?8for?8?5step?5must?5be?5a?5number?$AA@" = linkonce_odr unnamed_addr constant [28 x i8] c"'for' step must be a number\00", comdat, align 1
@"\01??_C@_0CF@JJFDEONC@?8for?8?5initial?5value?5must?5be?5a?5nu@" = linkonce_odr unnamed_addr constant [37 x i8] c"'for' initial value must be a number\00", comdat, align 1
; Function Attrs: nounwind
define void @testfunc(%struct.GCObject* nocapture readonly %obj) #0 {
entry:
%tt = getelementptr inbounds %struct.GCObject* %obj, i32 0, i32 1
%0 = load i8* %tt, align 1, !tbaa !1
%conv = zext i8 %0 to i32
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12 x i8]* @.str, i32 0, i32 0), i32 %conv) #2
define void @testfunc(%struct.GCObject* %obj) #0 {
%obj.addr = alloca %struct.GCObject*, align 8
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%1 = load %struct.GCObject*, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%tt = getelementptr inbounds %struct.GCObject, %struct.GCObject* %1, i32 0, i32 1
%2 = load i8, i8* %tt, align 8, !tbaa !6
%conv = zext i8 %2 to i32
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@", i32 0, i32 0), i32 %conv)
ret void
}
; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...) #0
declare i32 @printf(i8*, ...) #1
; Function Attrs: nounwind
define void @test1(%struct.lua_State* %L) #0 {
entry:
%L.addr = alloca %struct.lua_State*, align 8
%ci = alloca %struct.CallInfoLua*, align 8
%cl = alloca %struct.LClosure*, align 8
%k = alloca %struct.TValue*, align 8
%base = alloca %struct.TValue*, align 8
%cil = alloca %struct.CallInfoL*, align 8
%b = alloca i32, align 4
%A = alloca i32, align 4
%A1 = alloca i32, align 4
%A2 = alloca i32, align 4
%init = alloca %struct.TValue*, align 8
%plimit = alloca %struct.TValue*, align 8
%pstep = alloca %struct.TValue*, align 8
%ilimit = alloca i64, align 8
%stopnow = alloca i32, align 4
%init_is_integer = alloca i32, align 4
%pstep_is_integer = alloca i32, align 4
%fl = alloca i32, align 4
%initv = alloca i64, align 8
%ninit = alloca double, align 8
%nlimit = alloca double, align 8
%nstep = alloca double, align 8
%ci1 = getelementptr inbounds %struct.lua_State* %L, i32 0, i32 6
%0 = load %struct.CallInfoLua** %ci1, align 4, !tbaa !6
%base2 = getelementptr inbounds %struct.CallInfoLua* %0, i32 0, i32 4, i32 0
%1 = load %struct.TValue** %base2, align 4, !tbaa !12
%add.ptr = getelementptr inbounds %struct.TValue* %1, i32 1
%add.ptr5 = getelementptr inbounds %struct.TValue* %1, i32 2
%add.ptr6 = getelementptr inbounds %struct.TValue* %1, i32 3
%tt_ = getelementptr inbounds %struct.TValue* %1, i32 1, i32 1
%2 = load i32* %tt_, align 4, !tbaa !15
%cmp = icmp eq i32 %2, 19
%tt_7 = getelementptr inbounds %struct.TValue* %1, i32 3, i32 1
%3 = load i32* %tt_7, align 4, !tbaa !15
%cmp8 = icmp eq i32 %3, 19
%i = getelementptr inbounds %struct.TValue* %add.ptr6, i32 0, i32 0, i32 0
%4 = load i64* %i, align 8, !tbaa !17
%call = call i32 @forlimit(%struct.TValue* %add.ptr5, i64* %ilimit, i64 %4, i32* %stopnow) #2
%or.cond = and i1 %cmp, %cmp8
%tobool13 = icmp ne i32 %call, 0
%or.cond73 = and i1 %or.cond, %tobool13
br i1 %or.cond73, label %if.then, label %if.else
if.then: ; preds = %entry
%5 = load i32* %stopnow, align 4, !tbaa !18
%tobool14 = icmp eq i32 %5, 0
%i16 = getelementptr inbounds %struct.TValue* %add.ptr, i32 0, i32 0, i32 0
br i1 %tobool14, label %cond.false, label %cond.end
cond.false: ; preds = %if.then
%6 = load i64* %i16, align 8, !tbaa !17
br label %cond.end
cond.end: ; preds = %if.then, %cond.false
%cond = phi i64 [ %6, %cond.false ], [ 0, %if.then ]
%7 = load i64* %ilimit, align 8, !tbaa !17
%i18 = getelementptr inbounds %struct.TValue* %add.ptr5, i32 0, i32 0, i32 0
store i64 %7, i64* %i18, align 8, !tbaa !17
%tt_19 = getelementptr inbounds %struct.TValue* %1, i32 2, i32 1
store i32 19, i32* %tt_19, align 4, !tbaa !15
%8 = load i64* %i, align 8, !tbaa !17
%sub = sub nsw i64 %cond, %8
store i64 %sub, i64* %i16, align 8, !tbaa !17
br label %label_forloop
if.else: ; preds = %entry
%tt_25 = getelementptr inbounds %struct.TValue* %1, i32 2, i32 1
%9 = load i32* %tt_25, align 4, !tbaa !15
%cmp26 = icmp eq i32 %9, 3
br i1 %cmp26, label %if.then28, label %if.else30
if.then28: ; preds = %if.else
%n = bitcast %struct.TValue* %add.ptr5 to double*
%10 = load double* %n, align 8, !tbaa !19
store double %10, double* %nlimit, align 8, !tbaa !19
br label %if.end35
if.else30: ; preds = %if.else
%call31 = call i32 @luaV_tonumber_(%struct.TValue* %add.ptr5, double* %nlimit) #2
%phitmp = icmp eq i32 %call31, 0
br i1 %phitmp, label %if.then33, label %if.end35
if.then33: ; preds = %if.else30
%call34 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %L, i8* getelementptr inbounds ([29 x i8]* @.str1, i32 0, i32 0)) #2
br label %if.end35
if.end35: ; preds = %if.else30, %if.then28, %if.then33
%11 = load double* %nlimit, align 8, !tbaa !19
%n37 = bitcast %struct.TValue* %add.ptr5 to double*
store double %11, double* %n37, align 8, !tbaa !19
store i32 3, i32* %tt_25, align 4, !tbaa !15
%12 = load i32* %tt_7, align 4, !tbaa !15
%cmp40 = icmp eq i32 %12, 3
br i1 %cmp40, label %if.then42, label %if.else45
if.then42: ; preds = %if.end35
%n44 = bitcast %struct.TValue* %add.ptr6 to double*
%13 = load double* %n44, align 8, !tbaa !19
store double %13, double* %nstep, align 8, !tbaa !19
br label %if.end51
if.else45: ; preds = %if.end35
%call46 = call i32 @luaV_tonumber_(%struct.TValue* %add.ptr6, double* %nstep) #2
%phitmp104 = icmp eq i32 %call46, 0
br i1 %phitmp104, label %if.then49, label %if.end51
if.then49: ; preds = %if.else45
%call50 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %L, i8* getelementptr inbounds ([28 x i8]* @.str2, i32 0, i32 0)) #2
br label %if.end51
if.end51: ; preds = %if.else45, %if.then42, %if.then49
%14 = load double* %nstep, align 8, !tbaa !19
%n53 = bitcast %struct.TValue* %add.ptr6 to double*
store double %14, double* %n53, align 8, !tbaa !19
store i32 3, i32* %tt_7, align 4, !tbaa !15
%15 = load i32* %tt_, align 4, !tbaa !15
%cmp56 = icmp eq i32 %15, 3
br i1 %cmp56, label %if.then58, label %if.else61
if.then58: ; preds = %if.end51
%n60 = bitcast %struct.TValue* %add.ptr to double*
%16 = load double* %n60, align 8, !tbaa !19
store double %16, double* %ninit, align 8, !tbaa !19
br label %if.end67
if.else61: ; preds = %if.end51
%call62 = call i32 @luaV_tonumber_(%struct.TValue* %add.ptr, double* %ninit) #2
%phitmp105 = icmp eq i32 %call62, 0
br i1 %phitmp105, label %if.then65, label %if.end67
if.then65: ; preds = %if.else61
%call66 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %L, i8* getelementptr inbounds ([37 x i8]* @.str3, i32 0, i32 0)) #2
br label %if.end67
if.end67: ; preds = %if.else61, %if.then58, %if.then65
%17 = load double* %ninit, align 8, !tbaa !19
%18 = load double* %nstep, align 8, !tbaa !19
%sub68 = fsub double %17, %18
%n70 = bitcast %struct.TValue* %add.ptr to double*
store double %sub68, double* %n70, align 8, !tbaa !19
br label %label_forloop
label_forloop: ; preds = %cond.end, %if.end67
%storemerge = phi i32 [ 3, %if.end67 ], [ 19, %cond.end ]
store i32 %storemerge, i32* %tt_, align 4, !tbaa !15
%plimit_is_float = alloca i32, align 4
%pstep_is_float = alloca i32, align 4
%init_is_float = alloca i32, align 4
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !2
%1 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #3
%3 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %3) #3
%4 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %4) #3
%5 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %5) #3
%6 = bitcast i32* %b to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %6) #3
%7 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %7, i32 0, i32 6
%8 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 8, !tbaa !8
store %struct.CallInfoLua* %8, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%9 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %9, i32 0, i32 4
%base2 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l, i32 0, i32 0
%10 = load %struct.TValue*, %struct.TValue** %base2, align 8, !tbaa !14
store %struct.TValue* %10, %struct.TValue** %base, align 8, !tbaa !2
%11 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%func = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %11, i32 0, i32 0
%12 = load %struct.TValue*, %struct.TValue** %func, align 8, !tbaa !17
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %12, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%13 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !18
%14 = bitcast %struct.GCObject* %13 to %struct.LClosure*
store %struct.LClosure* %14, %struct.LClosure** %cl, align 8, !tbaa !2
%15 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !2
%p = getelementptr inbounds %struct.LClosure, %struct.LClosure* %15, i32 0, i32 5
%16 = load %struct.Proto*, %struct.Proto** %p, align 8, !tbaa !19
%k3 = getelementptr inbounds %struct.Proto, %struct.Proto* %16, i32 0, i32 14
%17 = load %struct.TValue*, %struct.TValue** %k3, align 8, !tbaa !21
store %struct.TValue* %17, %struct.TValue** %k, align 8, !tbaa !2
%18 = bitcast i32* %A to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %18) #3
%19 = bitcast i32* %A1 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %19) #3
%20 = bitcast i32* %A2 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %20) #3
br label %21
; <label>:21: ; preds = %0
store i32 1, i32* %A, align 4, !tbaa !24
%22 = load i32, i32* %A, align 4, !tbaa !24
%add = add nsw i32 %22, 1
store i32 %add, i32* %A1, align 4, !tbaa !24
%23 = load i32, i32* %A, align 4, !tbaa !24
%add4 = add nsw i32 %23, 2
store i32 %add4, i32* %A2, align 4, !tbaa !24
%24 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%25 = load i32, i32* %A, align 4, !tbaa !24
%idx.ext = sext i32 %25 to i64
%add.ptr = getelementptr inbounds %struct.TValue, %struct.TValue* %24, i64 %idx.ext
store %struct.TValue* %add.ptr, %struct.TValue** %init, align 8, !tbaa !2
%26 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%27 = load i32, i32* %A1, align 4, !tbaa !24
%idx.ext5 = sext i32 %27 to i64
%add.ptr6 = getelementptr inbounds %struct.TValue, %struct.TValue* %26, i64 %idx.ext5
store %struct.TValue* %add.ptr6, %struct.TValue** %plimit, align 8, !tbaa !2
%28 = load %struct.TValue*, %struct.TValue** %base, align 8, !tbaa !2
%29 = load i32, i32* %A2, align 4, !tbaa !24
%idx.ext7 = sext i32 %29 to i64
%add.ptr8 = getelementptr inbounds %struct.TValue, %struct.TValue* %28, i64 %idx.ext7
store %struct.TValue* %add.ptr8, %struct.TValue** %pstep, align 8, !tbaa !2
%30 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%tt_ = getelementptr inbounds %struct.TValue, %struct.TValue* %30, i32 0, i32 1
%31 = load i16, i16* %tt_, align 8, !tbaa !25
%conv = zext i16 %31 to i32
%cmp = icmp eq i32 %conv, 19
%conv9 = zext i1 %cmp to i32
store i32 %conv9, i32* %init_is_integer, align 4, !tbaa !24
%32 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%tt_10 = getelementptr inbounds %struct.TValue, %struct.TValue* %32, i32 0, i32 1
%33 = load i16, i16* %tt_10, align 8, !tbaa !25
%conv11 = zext i16 %33 to i32
%cmp12 = icmp eq i32 %conv11, 19
%conv13 = zext i1 %cmp12 to i32
store i32 %conv13, i32* %pstep_is_integer, align 4, !tbaa !24
%34 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%value_14 = getelementptr inbounds %struct.TValue, %struct.TValue* %34, i32 0, i32 0
%i = bitcast %union.Value* %value_14 to i64*
%35 = load i64, i64* %i, align 8, !tbaa !18
%36 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%call = call i32 @forlimit(%struct.TValue* %36, i64* %ilimit, i64 %35, i32* %stopnow)
store i32 %call, i32* %fl, align 4, !tbaa !24
%37 = load i32, i32* %init_is_integer, align 4, !tbaa !24
%tobool = icmp ne i32 %37, 0
br i1 %tobool, label %38, label %59
; <label>:38: ; preds = %21
%39 = load i32, i32* %pstep_is_integer, align 4, !tbaa !24
%tobool15 = icmp ne i32 %39, 0
br i1 %tobool15, label %40, label %59
; <label>:40: ; preds = %38
%41 = load i32, i32* %fl, align 4, !tbaa !24
%tobool16 = icmp ne i32 %41, 0
br i1 %tobool16, label %42, label %59
; <label>:42: ; preds = %40
%43 = bitcast i64* %initv to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %43) #3
%44 = load i32, i32* %stopnow, align 4, !tbaa !24
%tobool17 = icmp ne i32 %44, 0
br i1 %tobool17, label %45, label %46
; <label>:45: ; preds = %42
br label %49
; <label>:46: ; preds = %42
%47 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%value_18 = getelementptr inbounds %struct.TValue, %struct.TValue* %47, i32 0, i32 0
%i19 = bitcast %union.Value* %value_18 to i64*
%48 = load i64, i64* %i19, align 8, !tbaa !18
br label %49
; <label>:49: ; preds = %46, %45
%cond = phi i64 [ 0, %45 ], [ %48, %46 ]
store i64 %cond, i64* %initv, align 8, !tbaa !27
%50 = load i64, i64* %ilimit, align 8, !tbaa !27
%51 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%value_20 = getelementptr inbounds %struct.TValue, %struct.TValue* %51, i32 0, i32 0
%i21 = bitcast %union.Value* %value_20 to i64*
store i64 %50, i64* %i21, align 8, !tbaa !18
%52 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%tt_22 = getelementptr inbounds %struct.TValue, %struct.TValue* %52, i32 0, i32 1
store i16 19, i16* %tt_22, align 8, !tbaa !25
%53 = load i64, i64* %initv, align 8, !tbaa !27
%54 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%value_23 = getelementptr inbounds %struct.TValue, %struct.TValue* %54, i32 0, i32 0
%i24 = bitcast %union.Value* %value_23 to i64*
%55 = load i64, i64* %i24, align 8, !tbaa !18
%sub = sub nsw i64 %53, %55
%56 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%value_25 = getelementptr inbounds %struct.TValue, %struct.TValue* %56, i32 0, i32 0
%i26 = bitcast %union.Value* %value_25 to i64*
store i64 %sub, i64* %i26, align 8, !tbaa !18
%57 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%tt_27 = getelementptr inbounds %struct.TValue, %struct.TValue* %57, i32 0, i32 1
store i16 19, i16* %tt_27, align 8, !tbaa !25
%58 = bitcast i64* %initv to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %58) #3
br label %118
; <label>:59: ; preds = %40, %38, %21
%60 = bitcast double* %ninit to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %60) #3
%61 = bitcast double* %nlimit to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %61) #3
%62 = bitcast double* %nstep to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %62) #3
%63 = bitcast i32* %plimit_is_float to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %63) #3
store i32 0, i32* %plimit_is_float, align 4, !tbaa !24
%64 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%tt_28 = getelementptr inbounds %struct.TValue, %struct.TValue* %64, i32 0, i32 1
%65 = load i16, i16* %tt_28, align 8, !tbaa !25
%conv29 = zext i16 %65 to i32
%cmp30 = icmp eq i32 %conv29, 3
br i1 %cmp30, label %66, label %69
; <label>:66: ; preds = %59
store i32 1, i32* %plimit_is_float, align 4, !tbaa !24
%67 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%value_32 = getelementptr inbounds %struct.TValue, %struct.TValue* %67, i32 0, i32 0
%n = bitcast %union.Value* %value_32 to double*
%68 = load double, double* %n, align 8, !tbaa !18
store double %68, double* %nlimit, align 8, !tbaa !28
br label %71
; <label>:69: ; preds = %59
%70 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%call33 = call i32 @luaV_tonumber_(%struct.TValue* %70, double* %nlimit)
store i32 %call33, i32* %plimit_is_float, align 4, !tbaa !24
br label %71
; <label>:71: ; preds = %69, %66
%72 = load i32, i32* %plimit_is_float, align 4, !tbaa !24
%tobool34 = icmp ne i32 %72, 0
br i1 %tobool34, label %75, label %73
; <label>:73: ; preds = %71
%74 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call35 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %74, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @"\01??_C@_0BN@GHPMJMPH@?8for?8?5limit?5must?5be?5a?5number?$AA@", i32 0, i32 0))
br label %75
; <label>:75: ; preds = %73, %71
%76 = load double, double* %nlimit, align 8, !tbaa !28
%77 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%value_36 = getelementptr inbounds %struct.TValue, %struct.TValue* %77, i32 0, i32 0
%n37 = bitcast %union.Value* %value_36 to double*
store double %76, double* %n37, align 8, !tbaa !18
%78 = load %struct.TValue*, %struct.TValue** %plimit, align 8, !tbaa !2
%tt_38 = getelementptr inbounds %struct.TValue, %struct.TValue* %78, i32 0, i32 1
store i16 3, i16* %tt_38, align 8, !tbaa !25
%79 = bitcast i32* %pstep_is_float to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %79) #3
store i32 0, i32* %pstep_is_float, align 4, !tbaa !24
%80 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%tt_39 = getelementptr inbounds %struct.TValue, %struct.TValue* %80, i32 0, i32 1
%81 = load i16, i16* %tt_39, align 8, !tbaa !25
%conv40 = zext i16 %81 to i32
%cmp41 = icmp eq i32 %conv40, 3
br i1 %cmp41, label %82, label %85
; <label>:82: ; preds = %75
store i32 1, i32* %pstep_is_float, align 4, !tbaa !24
%83 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%value_43 = getelementptr inbounds %struct.TValue, %struct.TValue* %83, i32 0, i32 0
%n44 = bitcast %union.Value* %value_43 to double*
%84 = load double, double* %n44, align 8, !tbaa !18
store double %84, double* %nstep, align 8, !tbaa !28
br label %87
; <label>:85: ; preds = %75
%86 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%call45 = call i32 @luaV_tonumber_(%struct.TValue* %86, double* %nstep)
store i32 %call45, i32* %pstep_is_float, align 4, !tbaa !24
br label %87
; <label>:87: ; preds = %85, %82
%88 = load i32, i32* %pstep_is_float, align 4, !tbaa !24
%tobool46 = icmp ne i32 %88, 0
br i1 %tobool46, label %91, label %89
; <label>:89: ; preds = %87
%90 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call47 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %90, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @"\01??_C@_0BM@EGCFKNIJ@?8for?8?5step?5must?5be?5a?5number?$AA@", i32 0, i32 0))
br label %91
; <label>:91: ; preds = %89, %87
%92 = load double, double* %nstep, align 8, !tbaa !28
%93 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%value_48 = getelementptr inbounds %struct.TValue, %struct.TValue* %93, i32 0, i32 0
%n49 = bitcast %union.Value* %value_48 to double*
store double %92, double* %n49, align 8, !tbaa !18
%94 = load %struct.TValue*, %struct.TValue** %pstep, align 8, !tbaa !2
%tt_50 = getelementptr inbounds %struct.TValue, %struct.TValue* %94, i32 0, i32 1
store i16 3, i16* %tt_50, align 8, !tbaa !25
%95 = bitcast i32* %init_is_float to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %95) #3
store i32 0, i32* %init_is_float, align 4, !tbaa !24
%96 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%tt_51 = getelementptr inbounds %struct.TValue, %struct.TValue* %96, i32 0, i32 1
%97 = load i16, i16* %tt_51, align 8, !tbaa !25
%conv52 = zext i16 %97 to i32
%cmp53 = icmp eq i32 %conv52, 3
br i1 %cmp53, label %98, label %101
; <label>:98: ; preds = %91
store i32 1, i32* %init_is_float, align 4, !tbaa !24
%99 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%value_55 = getelementptr inbounds %struct.TValue, %struct.TValue* %99, i32 0, i32 0
%n56 = bitcast %union.Value* %value_55 to double*
%100 = load double, double* %n56, align 8, !tbaa !18
store double %100, double* %ninit, align 8, !tbaa !28
br label %103
; <label>:101: ; preds = %91
%102 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%call57 = call i32 @luaV_tonumber_(%struct.TValue* %102, double* %ninit)
store i32 %call57, i32* %init_is_float, align 4, !tbaa !24
br label %103
; <label>:103: ; preds = %101, %98
%104 = load i32, i32* %init_is_float, align 4, !tbaa !24
%tobool58 = icmp ne i32 %104, 0
br i1 %tobool58, label %107, label %105
; <label>:105: ; preds = %103
%106 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%call59 = call i32 bitcast (i32 (...)* @luaG_runerror to i32 (%struct.lua_State*, i8*)*)(%struct.lua_State* %106, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @"\01??_C@_0CF@JJFDEONC@?8for?8?5initial?5value?5must?5be?5a?5nu@", i32 0, i32 0))
br label %107
; <label>:107: ; preds = %105, %103
%108 = load double, double* %ninit, align 8, !tbaa !28
%109 = load double, double* %nstep, align 8, !tbaa !28
%sub60 = fsub double %108, %109
%110 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%value_61 = getelementptr inbounds %struct.TValue, %struct.TValue* %110, i32 0, i32 0
%n62 = bitcast %union.Value* %value_61 to double*
store double %sub60, double* %n62, align 8, !tbaa !18
%111 = load %struct.TValue*, %struct.TValue** %init, align 8, !tbaa !2
%tt_63 = getelementptr inbounds %struct.TValue, %struct.TValue* %111, i32 0, i32 1
store i16 3, i16* %tt_63, align 8, !tbaa !25
%112 = bitcast i32* %init_is_float to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %112) #3
%113 = bitcast i32* %pstep_is_float to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %113) #3
%114 = bitcast i32* %plimit_is_float to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %114) #3
%115 = bitcast double* %nstep to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %115) #3
%116 = bitcast double* %nlimit to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %116) #3
%117 = bitcast double* %ninit to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %117) #3
br label %118
; <label>:118: ; preds = %107, %49
br label %119
; <label>:119: ; preds = %118
%120 = bitcast i32* %A2 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %120) #3
%121 = bitcast i32* %A1 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %121) #3
%122 = bitcast i32* %A to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %122) #3
%123 = bitcast i32* %b to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %123) #3
%124 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %124) #3
%125 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %125) #3
%126 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %126) #3
%127 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %127) #3
%128 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %128) #3
ret void
}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
declare i32 @forlimit(%struct.TValue*, i64*, i64, i32*) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
declare i32 @luaV_tonumber_(%struct.TValue*, double*) #1
declare i32 @luaG_runerror(...) #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
!llvm.ident = !{!0}
!0 = metadata !{metadata !"clang version 3.6.0 (trunk)"}
!1 = metadata !{metadata !2, metadata !4, i64 4}
!2 = metadata !{metadata !"GCObject", metadata !3, i64 0, metadata !4, i64 4, metadata !4, i64 5}
!3 = metadata !{metadata !"any pointer", metadata !4, i64 0}
!4 = metadata !{metadata !"omnipotent char", metadata !5, i64 0}
!5 = metadata !{metadata !"Simple C/C++ TBAA"}
!6 = metadata !{metadata !7, metadata !3, i64 16}
!7 = metadata !{metadata !"lua_State", metadata !3, i64 0, metadata !4, i64 4, metadata !4, i64 5, metadata !4, i64 6, metadata !3, i64 8, metadata !3, i64 12, metadata !3, i64 16, metadata !3, i64 20, metadata !3, i64 24, metadata !3, i64 28, metadata !3, i64 32, metadata !3, i64 36, metadata !3, i64 40, metadata !3, i64 44, metadata !8, i64 48, metadata !3, i64 104, metadata !9, i64 112, metadata !11, i64 120, metadata !11, i64 124, metadata !11, i64 128, metadata !10, i64 132, metadata !10, i64 134, metadata !4, i64 136, metadata !4, i64 137}
!8 = metadata !{metadata !"CallInfo", metadata !3, i64 0, metadata !3, i64 4, metadata !3, i64 8, metadata !3, i64 12, metadata !4, i64 16, metadata !9, i64 40, metadata !10, i64 48, metadata !4, i64 50, metadata !4, i64 51}
!9 = metadata !{metadata !"long long", metadata !4, i64 0}
!10 = metadata !{metadata !"short", metadata !4, i64 0}
!11 = metadata !{metadata !"int", metadata !4, i64 0}
!12 = metadata !{metadata !13, metadata !3, i64 16}
!13 = metadata !{metadata !"CallInfoLua", metadata !3, i64 0, metadata !3, i64 4, metadata !3, i64 8, metadata !3, i64 12, metadata !14, i64 16, metadata !9, i64 32, metadata !10, i64 40, metadata !4, i64 42, metadata !4, i64 43}
!14 = metadata !{metadata !"CallInfoL", metadata !3, i64 0, metadata !3, i64 4, metadata !9, i64 8}
!15 = metadata !{metadata !16, metadata !11, i64 8}
!16 = metadata !{metadata !"TValue", metadata !4, i64 0, metadata !11, i64 8}
!17 = metadata !{metadata !9, metadata !9, i64 0}
!18 = metadata !{metadata !11, metadata !11, i64 0}
!19 = metadata !{metadata !20, metadata !20, i64 0}
!20 = metadata !{metadata !"double", metadata !4, i64 0}
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !4, i64 8}
!7 = !{!"GCObject", !3, i64 0, !4, i64 8, !4, i64 9}
!8 = !{!9, !3, i64 32}
!9 = !{!"lua_State", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !3, i64 32, !3, i64 40, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !10, i64 96, !3, i64 168, !11, i64 176, !13, i64 184, !13, i64 188, !13, i64 192, !12, i64 196, !12, i64 198, !4, i64 200, !4, i64 201, !12, i64 202, !4, i64 204}
!10 = !{!"CallInfo", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !4, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!11 = !{!"long long", !4, i64 0}
!12 = !{!"short", !4, i64 0}
!13 = !{!"int", !4, i64 0}
!14 = !{!15, !3, i64 32}
!15 = !{!"CallInfoLua", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !16, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!16 = !{!"CallInfoL", !3, i64 0, !3, i64 8, !11, i64 16}
!17 = !{!15, !3, i64 0}
!18 = !{!4, !4, i64 0}
!19 = !{!20, !3, i64 24}
!20 = !{!"LClosure", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !4, i64 32}
!21 = !{!22, !3, i64 48}
!22 = !{!"Proto", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !4, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !3, i64 96, !3, i64 104, !3, i64 112, !23, i64 120}
!23 = !{!"RaviJITProto", !4, i64 0, !4, i64 1, !12, i64 2, !3, i64 8, !3, i64 16}
!24 = !{!13, !13, i64 0}
!25 = !{!26, !12, i64 8}
!26 = !{!"TValue", !4, i64 0, !12, i64 8}
!27 = !{!11, !11, i64 0}
!28 = !{!29, !29, i64 0}
!29 = !{!"double", !4, i64 0}

@ -1,41 +1,43 @@
; ModuleID = 'lua_op_loadk_return.c'
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_op_loadk_return.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, i32, i32, i32 }
%struct.Upvaldesc = type { %struct.TString*, i32, i8, i8 }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8*, i32 (%struct.lua_State*)* }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
@.str = private unnamed_addr constant [12 x i8] c"value = %d\0A\00", align 1
$"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = comdat any
@"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@" = linkonce_odr unnamed_addr constant [12 x i8] c"value = %d\0A\00", comdat, align 1
; Function Attrs: nounwind
define void @testfunc(%struct.GCObject* %obj) #0 {
entry:
%obj.addr = alloca %struct.GCObject*, align 4
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 4, !tbaa !1
%0 = load %struct.GCObject*, %struct.GCObject** %obj.addr, align 4, !tbaa !1
%tt = getelementptr inbounds %struct.GCObject, %struct.GCObject* %0, i32 0, i32 1
%1 = load i8, i8* %tt, align 1, !tbaa !5
%conv = zext i8 %1 to i32
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 %conv)
%obj.addr = alloca %struct.GCObject*, align 8
store %struct.GCObject* %obj, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%1 = load %struct.GCObject*, %struct.GCObject** %obj.addr, align 8, !tbaa !2
%tt = getelementptr inbounds %struct.GCObject, %struct.GCObject* %1, i32 0, i32 1
%2 = load i8, i8* %tt, align 8, !tbaa !6
%conv = zext i8 %2 to i32
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"\01??_C@_0M@KDKGEOFG@value?5?$DN?5?$CFd?6?$AA@", i32 0, i32 0), i32 %conv)
ret void
}
@ -43,81 +45,83 @@ declare i32 @printf(i8*, ...) #1
; Function Attrs: nounwind
define void @test1(%struct.lua_State* %L, i32 %b, i32 %x) #0 {
entry:
%L.addr = alloca %struct.lua_State*, align 4
%b.addr = alloca i32, align 4
%x.addr = alloca i32, align 4
%ci = alloca %struct.CallInfoLua*, align 4
%cl = alloca %struct.LClosure*, align 4
%k = alloca %struct.TValue*, align 4
%base = alloca %struct.TValue*, align 4
%cil = alloca %struct.CallInfoL*, align 4
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 4, !tbaa !1
store i32 %b, i32* %b.addr, align 4, !tbaa !7
store i32 %x, i32* %x.addr, align 4, !tbaa !7
%0 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start(i64 4, i8* %0) #2
%1 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start(i64 4, i8* %1) #2
%2 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start(i64 4, i8* %2) #2
%3 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.start(i64 4, i8* %3) #2
%4 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.start(i64 4, i8* %4) #2
%5 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %5, i32 0, i32 6
%6 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 4, !tbaa !9
store %struct.CallInfoLua* %6, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%7 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %7, i32 0, i32 4
%b.addr = alloca i32, align 4
%L.addr = alloca %struct.lua_State*, align 8
%ci = alloca %struct.CallInfoLua*, align 8
%cl = alloca %struct.LClosure*, align 8
%k = alloca %struct.TValue*, align 8
%base = alloca %struct.TValue*, align 8
%cil = alloca %struct.CallInfoL*, align 8
store i32 %x, i32* %x.addr, align 4, !tbaa !8
store i32 %b, i32* %b.addr, align 4, !tbaa !8
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !2
%1 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #3
%3 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %3) #3
%4 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %4) #3
%5 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %5) #3
%6 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !2
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %6, i32 0, i32 6
%7 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 8, !tbaa !10
store %struct.CallInfoLua* %7, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%8 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %8, i32 0, i32 4
%base2 = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l, i32 0, i32 0
%8 = load %struct.TValue*, %struct.TValue** %base2, align 4, !tbaa !14
store %struct.TValue* %8, %struct.TValue** %base, align 4, !tbaa !1
%9 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l3 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %9, i32 0, i32 4
%9 = load %struct.TValue*, %struct.TValue** %base2, align 8, !tbaa !15
store %struct.TValue* %9, %struct.TValue** %base, align 8, !tbaa !2
%10 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !2
%l3 = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %10, i32 0, i32 4
%savedpc = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l3, i32 0, i32 1
store i32* %x.addr, i32** %savedpc, align 4, !tbaa !17
%10 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.end(i64 4, i8* %10) #2
%11 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.end(i64 4, i8* %11) #2
%12 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end(i64 4, i8* %12) #2
%13 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end(i64 4, i8* %13) #2
%14 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end(i64 4, i8* %14) #2
store i32* %x.addr, i32** %savedpc, align 8, !tbaa !18
%11 = bitcast %struct.CallInfoL** %cil to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %11) #3
%12 = bitcast %struct.TValue** %base to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %12) #3
%13 = bitcast %struct.TValue** %k to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %13) #3
%14 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %14) #3
%15 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %15) #3
ret void
}
; Function Attrs: nounwind
declare void @llvm.lifetime.start(i64, i8* nocapture) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2
; Function Attrs: nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{!"clang version 3.7.0 (trunk)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"any pointer", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{!6, !3, i64 4}
!6 = !{!"GCObject", !2, i64 0, !3, i64 4, !3, i64 5}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !3, i64 0}
!9 = !{!10, !2, i64 16}
!10 = !{!"lua_State", !2, i64 0, !3, i64 4, !3, i64 5, !3, i64 6, !2, i64 8, !2, i64 12, !2, i64 16, !2, i64 20, !2, i64 24, !2, i64 28, !2, i64 32, !2, i64 36, !2, i64 40, !2, i64 44, !11, i64 48, !2, i64 104, !12, i64 112, !8, i64 120, !8, i64 124, !8, i64 128, !13, i64 132, !13, i64 134, !3, i64 136, !3, i64 137}
!11 = !{!"CallInfo", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !3, i64 16, !12, i64 40, !13, i64 48, !3, i64 50, !3, i64 51}
!12 = !{!"long long", !3, i64 0}
!13 = !{!"short", !3, i64 0}
!14 = !{!15, !2, i64 16}
!15 = !{!"CallInfoLua", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !16, i64 16, !12, i64 32, !13, i64 40, !3, i64 42, !3, i64 43}
!16 = !{!"CallInfoL", !2, i64 0, !2, i64 4, !12, i64 8}
!17 = !{!15, !2, i64 20}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !4, i64 8}
!7 = !{!"GCObject", !3, i64 0, !4, i64 8, !4, i64 9}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !4, i64 0}
!10 = !{!11, !3, i64 32}
!11 = !{!"lua_State", !3, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !3, i64 16, !3, i64 24, !3, i64 32, !3, i64 40, !3, i64 48, !3, i64 56, !3, i64 64, !3, i64 72, !3, i64 80, !3, i64 88, !12, i64 96, !3, i64 168, !13, i64 176, !9, i64 184, !9, i64 188, !9, i64 192, !14, i64 196, !14, i64 198, !4, i64 200, !4, i64 201, !14, i64 202, !4, i64 204}
!12 = !{!"CallInfo", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !4, i64 32, !13, i64 56, !14, i64 64, !14, i64 66, !14, i64 68, !4, i64 70, !4, i64 71}
!13 = !{!"long long", !4, i64 0}
!14 = !{!"short", !4, i64 0}
!15 = !{!16, !3, i64 32}
!16 = !{!"CallInfoLua", !3, i64 0, !3, i64 8, !3, i64 16, !3, i64 24, !17, i64 32, !13, i64 56, !14, i64 64, !14, i64 66, !14, i64 68, !4, i64 70, !4, i64 71}
!17 = !{!"CallInfoL", !3, i64 0, !3, i64 8, !13, i64 16}
!18 = !{!16, !3, i64 40}

@ -1,145 +1,150 @@
; ModuleID = 'lua_savedpc.c'
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_savedpc.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, i32, i32, i32 }
%struct.Upvaldesc = type { %struct.TString*, i32, i8, i8 }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8*, i32 (%struct.lua_State*)* }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
; Function Attrs: nounwind
define void @test1(%struct.lua_State* %L, i32 %b) #0 {
entry:
%L.addr = alloca %struct.lua_State*, align 4
%b.addr = alloca i32, align 4
%ci = alloca %struct.CallInfoLua*, align 4
%cl = alloca %struct.LClosure*, align 4
%p = alloca %struct.Proto*, align 4
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 4, !tbaa !1
store i32 %b, i32* %b.addr, align 4, !tbaa !5
%0 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start(i64 4, i8* %0) #1
%1 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start(i64 4, i8* %1) #1
%2 = bitcast %struct.Proto** %p to i8*
call void @llvm.lifetime.start(i64 4, i8* %2) #1
%3 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %3, i32 0, i32 6
%4 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 4, !tbaa !7
store %struct.CallInfoLua* %4, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%5 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%func = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %5, i32 0, i32 0
%6 = load %struct.TValue*, %struct.TValue** %func, align 4, !tbaa !12
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %6, i32 0, i32 0
%L.addr = alloca %struct.lua_State*, align 8
%ci = alloca %struct.CallInfoLua*, align 8
%cl = alloca %struct.LClosure*, align 8
%p = alloca %struct.Proto*, align 8
store i32 %b, i32* %b.addr, align 4, !tbaa !2
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !6
%1 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #3
%3 = bitcast %struct.Proto** %p to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %3) #3
%4 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%ci1 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %4, i32 0, i32 6
%5 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci1, align 8, !tbaa !8
store %struct.CallInfoLua* %5, %struct.CallInfoLua** %ci, align 8, !tbaa !6
%6 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !6
%func = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %6, i32 0, i32 0
%7 = load %struct.TValue*, %struct.TValue** %func, align 8, !tbaa !13
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %7, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%7 = load %struct.GCObject*, %struct.GCObject** %gc, align 4, !tbaa !1
%8 = bitcast %struct.GCObject* %7 to %struct.LClosure*
store %struct.LClosure* %8, %struct.LClosure** %cl, align 4, !tbaa !1
%9 = load %struct.LClosure*, %struct.LClosure** %cl, align 4, !tbaa !1
%p2 = getelementptr inbounds %struct.LClosure, %struct.LClosure* %9, i32 0, i32 5
%10 = load %struct.Proto*, %struct.Proto** %p2, align 4, !tbaa !15
store %struct.Proto* %10, %struct.Proto** %p, align 4, !tbaa !1
%11 = load i32, i32* %b.addr, align 4, !tbaa !5
%12 = load %struct.Proto*, %struct.Proto** %p, align 4, !tbaa !1
%8 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !16
%9 = bitcast %struct.GCObject* %8 to %struct.LClosure*
store %struct.LClosure* %9, %struct.LClosure** %cl, align 8, !tbaa !6
%10 = load %struct.LClosure*, %struct.LClosure** %cl, align 8, !tbaa !6
%p2 = getelementptr inbounds %struct.LClosure, %struct.LClosure* %10, i32 0, i32 5
%11 = load %struct.Proto*, %struct.Proto** %p2, align 8, !tbaa !17
store %struct.Proto* %11, %struct.Proto** %p, align 8, !tbaa !6
%12 = load %struct.Proto*, %struct.Proto** %p, align 8, !tbaa !6
%code = getelementptr inbounds %struct.Proto, %struct.Proto* %12, i32 0, i32 15
%13 = load i32*, i32** %code, align 4, !tbaa !17
%arrayidx = getelementptr inbounds i32, i32* %13, i32 %11
%14 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 4, !tbaa !1
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %14, i32 0, i32 4
%13 = load i32*, i32** %code, align 8, !tbaa !19
%14 = load i32, i32* %b.addr, align 4, !tbaa !2
%idxprom = sext i32 %14 to i64
%arrayidx = getelementptr inbounds i32, i32* %13, i64 %idxprom
%15 = load %struct.CallInfoLua*, %struct.CallInfoLua** %ci, align 8, !tbaa !6
%l = getelementptr inbounds %struct.CallInfoLua, %struct.CallInfoLua* %15, i32 0, i32 4
%savedpc = getelementptr inbounds %struct.CallInfoL, %struct.CallInfoL* %l, i32 0, i32 1
store i32* %arrayidx, i32** %savedpc, align 4, !tbaa !20
%15 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
%hookmask = getelementptr inbounds %struct.lua_State, %struct.lua_State* %15, i32 0, i32 22
%16 = load i8, i8* %hookmask, align 1, !tbaa !21
%conv = zext i8 %16 to i32
store i32* %arrayidx, i32** %savedpc, align 8, !tbaa !22
%16 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%hookmask = getelementptr inbounds %struct.lua_State, %struct.lua_State* %16, i32 0, i32 22
%17 = load i8, i8* %hookmask, align 8, !tbaa !23
%conv = zext i8 %17 to i32
%and = and i32 %conv, 12
%tobool = icmp ne i32 %and, 0
br i1 %tobool, label %land.lhs.true, label %if.end
br i1 %tobool, label %18, label %26
land.lhs.true: ; preds = %entry
%17 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
%hookcount = getelementptr inbounds %struct.lua_State, %struct.lua_State* %17, i32 0, i32 19
%18 = load i32, i32* %hookcount, align 4, !tbaa !22
%dec = add nsw i32 %18, -1
store i32 %dec, i32* %hookcount, align 4, !tbaa !22
; <label>:18: ; preds = %0
%19 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%hookcount = getelementptr inbounds %struct.lua_State, %struct.lua_State* %19, i32 0, i32 19
%20 = load i32, i32* %hookcount, align 8, !tbaa !24
%dec = add nsw i32 %20, -1
store i32 %dec, i32* %hookcount, align 8, !tbaa !24
%cmp = icmp eq i32 %dec, 0
br i1 %cmp, label %if.then, label %lor.lhs.false
br i1 %cmp, label %24, label %21
lor.lhs.false: ; preds = %land.lhs.true
%19 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
%hookmask4 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %19, i32 0, i32 22
%20 = load i8, i8* %hookmask4, align 1, !tbaa !21
%conv5 = zext i8 %20 to i32
; <label>:21: ; preds = %18
%22 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
%hookmask4 = getelementptr inbounds %struct.lua_State, %struct.lua_State* %22, i32 0, i32 22
%23 = load i8, i8* %hookmask4, align 8, !tbaa !23
%conv5 = zext i8 %23 to i32
%and6 = and i32 %conv5, 4
%tobool7 = icmp ne i32 %and6, 0
br i1 %tobool7, label %if.then, label %if.end
br i1 %tobool7, label %24, label %26
if.then: ; preds = %lor.lhs.false, %land.lhs.true
%21 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 4, !tbaa !1
call void @luaG_traceexec(%struct.lua_State* %21)
br label %if.end
; <label>:24: ; preds = %21, %18
%25 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
call void @luaG_traceexec(%struct.lua_State* %25)
br label %26
if.end: ; preds = %if.then, %lor.lhs.false, %entry
%22 = bitcast %struct.Proto** %p to i8*
call void @llvm.lifetime.end(i64 4, i8* %22) #1
%23 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end(i64 4, i8* %23) #1
%24 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end(i64 4, i8* %24) #1
; <label>:26: ; preds = %24, %21, %0
%27 = bitcast %struct.Proto** %p to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %27) #3
%28 = bitcast %struct.LClosure** %cl to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %28) #3
%29 = bitcast %struct.CallInfoLua** %ci to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %29) #3
ret void
}
; Function Attrs: nounwind
declare void @llvm.lifetime.start(i64, i8* nocapture) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare void @luaG_traceexec(%struct.lua_State*) #2
; Function Attrs: nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{!"clang version 3.7.0 (trunk)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"any pointer", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !3, i64 0}
!7 = !{!8, !2, i64 16}
!8 = !{!"lua_State", !2, i64 0, !3, i64 4, !3, i64 5, !3, i64 6, !2, i64 8, !2, i64 12, !2, i64 16, !2, i64 20, !2, i64 24, !2, i64 28, !2, i64 32, !2, i64 36, !2, i64 40, !2, i64 44, !9, i64 48, !2, i64 104, !10, i64 112, !6, i64 120, !6, i64 124, !6, i64 128, !11, i64 132, !11, i64 134, !3, i64 136, !3, i64 137}
!9 = !{!"CallInfo", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !3, i64 16, !10, i64 40, !11, i64 48, !3, i64 50, !3, i64 51}
!10 = !{!"long long", !3, i64 0}
!11 = !{!"short", !3, i64 0}
!12 = !{!13, !2, i64 0}
!13 = !{!"CallInfoLua", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !14, i64 16, !10, i64 32, !11, i64 40, !3, i64 42, !3, i64 43}
!14 = !{!"CallInfoL", !2, i64 0, !2, i64 4, !10, i64 8}
!15 = !{!16, !2, i64 12}
!16 = !{!"LClosure", !2, i64 0, !3, i64 4, !3, i64 5, !3, i64 6, !2, i64 8, !2, i64 12, !3, i64 16}
!17 = !{!18, !2, i64 48}
!18 = !{!"Proto", !2, i64 0, !3, i64 4, !3, i64 5, !3, i64 6, !3, i64 7, !3, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !2, i64 44, !2, i64 48, !2, i64 52, !2, i64 56, !2, i64 60, !2, i64 64, !2, i64 68, !2, i64 72, !2, i64 76, !19, i64 80}
!19 = !{!"RaviJITProto", !3, i64 0, !2, i64 4, !2, i64 8}
!20 = !{!13, !2, i64 20}
!21 = !{!8, !3, i64 136}
!22 = !{!8, !6, i64 128}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"int", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !4, i64 0}
!8 = !{!9, !7, i64 32}
!9 = !{!"lua_State", !7, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !7, i64 168, !11, i64 176, !3, i64 184, !3, i64 188, !3, i64 192, !12, i64 196, !12, i64 198, !4, i64 200, !4, i64 201, !12, i64 202, !4, i64 204}
!10 = !{!"CallInfo", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !4, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!11 = !{!"long long", !4, i64 0}
!12 = !{!"short", !4, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"CallInfoLua", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !15, i64 32, !11, i64 56, !12, i64 64, !12, i64 66, !12, i64 68, !4, i64 70, !4, i64 71}
!15 = !{!"CallInfoL", !7, i64 0, !7, i64 8, !11, i64 16}
!16 = !{!4, !4, i64 0}
!17 = !{!18, !7, i64 24}
!18 = !{!"LClosure", !7, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !7, i64 16, !7, i64 24, !4, i64 32}
!19 = !{!20, !7, i64 56}
!20 = !{!"Proto", !7, i64 0, !4, i64 8, !4, i64 9, !4, i64 10, !4, i64 11, !4, i64 12, !3, i64 16, !3, i64 20, !3, i64 24, !3, i64 28, !3, i64 32, !3, i64 36, !3, i64 40, !3, i64 44, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !21, i64 120}
!21 = !{!"RaviJITProto", !4, i64 0, !4, i64 1, !12, i64 2, !7, i64 8, !7, i64 16}
!22 = !{!14, !7, i64 40}
!23 = !{!9, !4, i64 200}
!24 = !{!9, !3, i64 192}

@ -1,83 +1,158 @@
; ModuleID = 'lua_upval.c'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-gnu"
source_filename = "lua_upval.c"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i8, i8 }
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.TValue }
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i8, i8 }
%union.anon = type { %struct.CallInfoC }
%struct.CallInfoC = type { i32 (%struct.lua_State*, i32, i64)*, i64, i64 }
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.LClosure = type { %struct.GCObject*, i8, i8, i8, %struct.GCObject*, %struct.Proto*, [1 x %struct.UpVal*] }
%struct.Proto = type { %struct.GCObject*, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.TValue*, i32*, %struct.Proto**, i32*, %struct.LocVar*, %struct.Upvaldesc*, %struct.LClosure*, %struct.TString*, %struct.GCObject*, %struct.RaviJITProto }
%struct.LocVar = type { %struct.TString*, i32, i32, i32 }
%struct.Upvaldesc = type { %struct.TString*, i32, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i32, i64, %struct.TString* }
%struct.RaviJITProto = type { i8, i8*, i32 (%struct.lua_State*)* }
%struct.LocVar = type { %struct.TString*, %struct.TString*, i32, i32, i8 }
%struct.Upvaldesc = type { %struct.TString*, %struct.TString*, i8, i8, i8 }
%struct.TString = type { %struct.GCObject*, i8, i8, i8, i8, i32, %union.anon.1 }
%union.anon.1 = type { i64 }
%struct.RaviJITProto = type { i8, i8, i16, i8*, i32 (%struct.lua_State*)* }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
; Function Attrs: nounwind
define void @luaV_op_call(%struct.lua_State* %L, %struct.LClosure* nocapture readonly %cl, %struct.TValue* nocapture readonly %ra, i32 %b, i32 %c) #0 {
entry:
%arrayidx = getelementptr inbounds %struct.LClosure* %cl, i32 0, i32 6, i32 %b
%0 = load %struct.UpVal** %arrayidx, align 4, !tbaa !1
%tt_ = getelementptr inbounds %struct.TValue* %ra, i32 0, i32 1
%1 = load i32* %tt_, align 4, !tbaa !5
%v = getelementptr inbounds %struct.UpVal* %0, i32 0, i32 0
%2 = load %struct.TValue** %v, align 4, !tbaa !8
%tt_1 = getelementptr inbounds %struct.TValue* %2, i32 0, i32 1
store i32 %1, i32* %tt_1, align 4, !tbaa !5
%n = bitcast %struct.TValue* %ra to double*
%3 = load double* %n, align 8, !tbaa !11
%4 = bitcast %struct.UpVal* %0 to double**
%5 = load double** %4, align 4, !tbaa !8
store double %3, double* %5, align 8, !tbaa !11
%6 = load %struct.TValue** %v, align 4, !tbaa !8
%tt_6 = getelementptr inbounds %struct.TValue* %6, i32 0, i32 1
%7 = load i32* %tt_6, align 4, !tbaa !5
%and = and i32 %7, 64
%value = getelementptr inbounds %struct.UpVal* %0, i32 0, i32 2, i32 0
%tt_7 = getelementptr inbounds %struct.UpVal* %0, i32 0, i32 2, i32 0, i32 1
store i32 1, i32* %tt_7, align 4, !tbaa !5
%8 = load %struct.TValue** %v, align 4, !tbaa !8
%cmp = icmp ne %struct.TValue* %8, %value
%tobool = icmp eq i32 %and, 0
%or.cond = or i1 %tobool, %cmp
br i1 %or.cond, label %if.end, label %if.then
define void @luaV_op_call(%struct.lua_State* %L, %struct.LClosure* %cl, %struct.TValue* %ra, i32 %b, i32 %c) #0 {
%c.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%ra.addr = alloca %struct.TValue*, align 8
%cl.addr = alloca %struct.LClosure*, align 8
%L.addr = alloca %struct.lua_State*, align 8
%uv = alloca %struct.UpVal*, align 8
%b1 = alloca i32, align 4
%value8 = alloca %struct.TValue*, align 8
%b2 = alloca i32, align 4
store i32 %c, i32* %c.addr, align 4, !tbaa !2
store i32 %b, i32* %b.addr, align 4, !tbaa !2
store %struct.TValue* %ra, %struct.TValue** %ra.addr, align 8, !tbaa !6
store %struct.LClosure* %cl, %struct.LClosure** %cl.addr, align 8, !tbaa !6
store %struct.lua_State* %L, %struct.lua_State** %L.addr, align 8, !tbaa !6
%1 = bitcast %struct.UpVal** %uv to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #3
%2 = load %struct.LClosure*, %struct.LClosure** %cl.addr, align 8, !tbaa !6
%upvals = getelementptr inbounds %struct.LClosure, %struct.LClosure* %2, i32 0, i32 6
%3 = load i32, i32* %b.addr, align 4, !tbaa !2
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds [1 x %struct.UpVal*], [1 x %struct.UpVal*]* %upvals, i64 0, i64 %idxprom
%4 = load %struct.UpVal*, %struct.UpVal** %arrayidx, align 8, !tbaa !6
store %struct.UpVal* %4, %struct.UpVal** %uv, align 8, !tbaa !6
%5 = load %struct.TValue*, %struct.TValue** %ra.addr, align 8, !tbaa !6
%tt_ = getelementptr inbounds %struct.TValue, %struct.TValue* %5, i32 0, i32 1
%6 = load i16, i16* %tt_, align 8, !tbaa !8
%7 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%v = getelementptr inbounds %struct.UpVal, %struct.UpVal* %7, i32 0, i32 0
%8 = load %struct.TValue*, %struct.TValue** %v, align 8, !tbaa !11
%tt_1 = getelementptr inbounds %struct.TValue, %struct.TValue* %8, i32 0, i32 1
store i16 %6, i16* %tt_1, align 8, !tbaa !8
%9 = load %struct.TValue*, %struct.TValue** %ra.addr, align 8, !tbaa !6
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %9, i32 0, i32 0
%n = bitcast %union.Value* %value_ to double*
%10 = load double, double* %n, align 8, !tbaa !14
%11 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%v2 = getelementptr inbounds %struct.UpVal, %struct.UpVal* %11, i32 0, i32 0
%12 = load %struct.TValue*, %struct.TValue** %v2, align 8, !tbaa !11
%value_3 = getelementptr inbounds %struct.TValue, %struct.TValue* %12, i32 0, i32 0
%n4 = bitcast %union.Value* %value_3 to double*
store double %10, double* %n4, align 8, !tbaa !14
%13 = bitcast i32* %b1 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %13) #3
%14 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%v5 = getelementptr inbounds %struct.UpVal, %struct.UpVal* %14, i32 0, i32 0
%15 = load %struct.TValue*, %struct.TValue** %v5, align 8, !tbaa !11
%tt_6 = getelementptr inbounds %struct.TValue, %struct.TValue* %15, i32 0, i32 1
%16 = load i16, i16* %tt_6, align 8, !tbaa !8
%conv = zext i16 %16 to i32
%and = and i32 %conv, 32768
store i32 %and, i32* %b1, align 4, !tbaa !2
%17 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%u = getelementptr inbounds %struct.UpVal, %struct.UpVal* %17, i32 0, i32 2
%value = bitcast %union.anon.0* %u to %struct.TValue*
%tt_7 = getelementptr inbounds %struct.TValue, %struct.TValue* %value, i32 0, i32 1
store i16 1, i16* %tt_7, align 8, !tbaa !14
%18 = bitcast %struct.TValue** %value8 to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* %18) #3
%19 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%u9 = getelementptr inbounds %struct.UpVal, %struct.UpVal* %19, i32 0, i32 2
%value10 = bitcast %union.anon.0* %u9 to %struct.TValue*
store %struct.TValue* %value10, %struct.TValue** %value8, align 8, !tbaa !6
%20 = bitcast i32* %b2 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %20) #3
%21 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%v11 = getelementptr inbounds %struct.UpVal, %struct.UpVal* %21, i32 0, i32 0
%22 = load %struct.TValue*, %struct.TValue** %v11, align 8, !tbaa !11
%23 = load %struct.TValue*, %struct.TValue** %value8, align 8, !tbaa !6
%cmp = icmp ne %struct.TValue* %22, %23
%conv12 = zext i1 %cmp to i32
store i32 %conv12, i32* %b2, align 4, !tbaa !2
%24 = load i32, i32* %b1, align 4, !tbaa !2
%tobool = icmp ne i32 %24, 0
br i1 %tobool, label %25, label %30
if.then: ; preds = %entry
tail call void @luaC_upvalbarrier_(%struct.lua_State* %L, %struct.UpVal* %0) #2
br label %if.end
; <label>:25: ; preds = %0
%26 = load i32, i32* %b2, align 4, !tbaa !2
%tobool13 = icmp ne i32 %26, 0
br i1 %tobool13, label %30, label %27
if.end: ; preds = %entry, %if.then
; <label>:27: ; preds = %25
%28 = load %struct.UpVal*, %struct.UpVal** %uv, align 8, !tbaa !6
%29 = load %struct.lua_State*, %struct.lua_State** %L.addr, align 8, !tbaa !6
call void @luaC_upvalbarrier_(%struct.lua_State* %29, %struct.UpVal* %28)
br label %30
; <label>:30: ; preds = %27, %25, %0
%31 = bitcast i32* %b2 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %31) #3
%32 = bitcast %struct.TValue** %value8 to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %32) #3
%33 = bitcast i32* %b1 to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %33) #3
%34 = bitcast %struct.UpVal** %uv to i8*
call void @llvm.lifetime.end.p0i8(i64 8, i8* %34) #3
ret void
}
declare void @luaC_upvalbarrier_(%struct.lua_State*, %struct.UpVal*) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare void @luaC_upvalbarrier_(%struct.lua_State*, %struct.UpVal*) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = metadata !{metadata !"clang version 3.6.0 (trunk)"}
!1 = metadata !{metadata !2, metadata !2, i64 0}
!2 = metadata !{metadata !"any pointer", metadata !3, i64 0}
!3 = metadata !{metadata !"omnipotent char", metadata !4, i64 0}
!4 = metadata !{metadata !"Simple C/C++ TBAA"}
!5 = metadata !{metadata !6, metadata !7, i64 8}
!6 = metadata !{metadata !"TValue", metadata !3, i64 0, metadata !7, i64 8}
!7 = metadata !{metadata !"int", metadata !3, i64 0}
!8 = metadata !{metadata !9, metadata !2, i64 0}
!9 = metadata !{metadata !"UpVal", metadata !2, i64 0, metadata !10, i64 8, metadata !3, i64 16}
!10 = metadata !{metadata !"long long", metadata !3, i64 0}
!11 = metadata !{metadata !12, metadata !12, i64 0}
!12 = metadata !{metadata !"double", metadata !3, i64 0}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"int", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !4, i64 0}
!8 = !{!9, !10, i64 8}
!9 = !{!"TValue", !4, i64 0, !10, i64 8}
!10 = !{!"short", !4, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"UpVal", !7, i64 0, !13, i64 8, !4, i64 16}
!13 = !{!"long long", !4, i64 0}
!14 = !{!4, !4, i64 0}

@ -1,5 +1,5 @@
setlocal
set PATH=%PATH%;"c:\Program Files (x86)\LLVM\bin"
set PATH=%PATH%;"c:\Software\clang6\bin"
rem clang -cc1 -O1 -disable-llvm-optzns -S -emit-llvm %1
clang -cc1 -O2 -S -emit-llvm %1
clang -cc1 -O1 -disable-llvm-optzns -S -emit-llvm %1
rem clang -cc1 -O2 -S -emit-llvm %1

@ -1,37 +1,53 @@
; ModuleID = 'tab.c'
source_filename = "tab.c"
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"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%struct.TValue = type { %union.Value, i32 }
%union.Value = type { i64 }
%struct.TValue = type { %union.Value, i16 }
%union.Value = type { %struct.GCObject* }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%union.GCUnion = type { %struct.lua_State }
%struct.lua_State = type { %struct.GCObject*, i8, i8, i8, %struct.TValue*, %struct.global_State*, %struct.CallInfoLua*, i32*, %struct.TValue*, %struct.TValue*, %struct.UpVal*, %struct.GCObject*, %struct.lua_State*, %struct.lua_longjmp*, %struct.CallInfo, void (%struct.lua_State*, %struct.lua_Debug*)*, i64, i32, i32, i32, i16, i16, i8, i8, i16, i8 }
%struct.global_State = type opaque
%struct.CallInfoLua = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %struct.CallInfoL, i64, i16, i16, i16, i8, i8 }
%struct.CallInfoL = type { %struct.TValue*, i32*, i64 }
%struct.UpVal = type { %struct.TValue*, i64, %union.anon.0 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { %struct.UpVal*, i32 }
%struct.lua_longjmp = type opaque
%struct.CallInfo = type { %struct.TValue*, %struct.TValue*, %struct.CallInfo*, %struct.CallInfo*, %union.anon, i64, i16, i16, i16, i8, i8 }
%union.anon = type { %struct.CallInfoL }
%struct.lua_Debug = type opaque
%struct.Table = type { %struct.GCObject*, i8, i8, i8, i8, i32, %struct.TValue*, %struct.Node*, %struct.Node*, %struct.Table*, %struct.GCObject*, %struct.RaviArray, i32 }
%struct.Node = type { %struct.TValue, %union.TKey }
%union.TKey = type { %struct.anon.2 }
%struct.anon.2 = type { %union.Value, i32, i32 }
%struct.GCObject = type { %struct.GCObject*, i8, i8 }
%struct.RaviArray = type { i8*, i32, i32, i32 }
%struct.anon.2 = type { %union.Value, i16, i32 }
%struct.RaviArray = type { i8*, i32, i32, i8, i8 }
; Function Attrs: norecurse nounwind readonly
define i32 @tablevalue(%struct.TValue* nocapture readonly %v) local_unnamed_addr #0 {
entry:
%0 = bitcast %struct.TValue* %v to %struct.Table**
%1 = load %struct.Table*, %struct.Table** %0, align 8, !tbaa !1
%sizearray = getelementptr inbounds %struct.Table, %struct.Table* %1, i32 0, i32 5
%2 = load i32, i32* %sizearray, align 8, !tbaa !5
ret i32 %2
; Function Attrs: nounwind
define i32 @tablevalue(%struct.TValue* %v) #0 {
%v.addr = alloca %struct.TValue*, align 8
store %struct.TValue* %v, %struct.TValue** %v.addr, align 8, !tbaa !2
%1 = load %struct.TValue*, %struct.TValue** %v.addr, align 8, !tbaa !2
%value_ = getelementptr inbounds %struct.TValue, %struct.TValue* %1, i32 0, i32 0
%gc = bitcast %union.Value* %value_ to %struct.GCObject**
%2 = load %struct.GCObject*, %struct.GCObject** %gc, align 8, !tbaa !6
%3 = bitcast %struct.GCObject* %2 to %union.GCUnion*
%h = bitcast %union.GCUnion* %3 to %struct.Table*
%sizearray = getelementptr inbounds %struct.Table, %struct.Table* %h, i32 0, i32 5
%4 = load i32, i32* %sizearray, align 4, !tbaa !6
ret i32 %4
}
attributes #0 = { norecurse nounwind readonly "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{!0}
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{!"clang version 3.9.0 (trunk)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"any pointer", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{!6, !7, i64 8}
!6 = !{!"Table", !2, i64 0, !3, i64 4, !3, i64 5, !3, i64 6, !3, i64 7, !7, i64 8, !2, i64 12, !2, i64 16, !2, i64 20, !2, i64 24, !2, i64 28, !8, i64 32, !7, i64 48}
!7 = !{!"int", !3, i64 0}
!8 = !{!"RaviArray", !2, i64 0, !3, i64 4, !7, i64 8, !7, i64 12}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{!"clang version 6.0.0 (tags/RELEASE_600/final)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"any pointer", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!4, !4, i64 0}

@ -10,7 +10,7 @@
#include <stdarg.h>
#include <stdint.h>
#include "llimits.h"
#include "lua.h"
@ -63,7 +63,7 @@
/* Bit mark for collectable types */
#define BIT_ISCOLLECTABLE (1 << 7)
#define BIT_ISCOLLECTABLE (1 << 15)
/* mark a tag as collectable */
#define ctb(t) ((t) | BIT_ISCOLLECTABLE)
@ -74,10 +74,14 @@
*/
typedef struct GCObject GCObject;
/* Extended to 16-bits so that we can hold more info */
typedef uint16_t LuaType;
/*
** Common Header for all collectable objects (in macro form, to be
** included in other objects)
** Note that tt field is a byte - this means that a GC object's
** type must have all information in the first byte
*/
#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
@ -110,7 +114,7 @@ typedef union Value {
} Value;
#define TValuefields Value value_; lu_byte tt_
#define TValuefields Value value_; LuaType tt_
typedef struct lua_TValue {
@ -130,10 +134,10 @@ typedef struct lua_TValue {
#define rttype(o) ((o)->tt_)
/* tag with no variants (bits 0-3) */
#define novariant(x) ((x) & 0x0F)
#define novariant(x) ((x) & 0x000F)
/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */
#define ttype(o) (rttype(o) & 0x3F)
#define ttype(o) (rttype(o) & 0x7FFF)
/* type tag of a TValue with no variants (bits 0-3) */
#define ttnov(o) (novariant(rttype(o)))
@ -370,7 +374,7 @@ typedef union UTString {
*/
typedef struct Udata {
CommonHeader;
lu_byte ttuv_; /* user value's tag */
LuaType ttuv_; /* user value's tag */
struct Table *metatable;
size_t len; /* number of bytes */
union Value user_; /* user value */

@ -102,6 +102,7 @@ enum LuaTypeCode {
// Lua types are gathered here
struct LuaLLVMTypes {
LuaLLVMTypes(llvm::LLVMContext &context);
void addCommonGCHeader(std::vector<llvm::Type *> &elements);
void dump();
// Following are standard C types
@ -133,6 +134,8 @@ struct LuaLLVMTypes {
// WARNING: We currently assume that lua_Unsigned is
// 64-bit
llvm::Type *lua_UnsignedT;
llvm::Type *lua_LuaTypeT;
llvm::Type *lua_KContextT;
llvm::FunctionType *lua_CFunctionT;
@ -296,7 +299,6 @@ struct LuaLLVMTypes {
std::array<llvm::Constant *, 256> kInt;
std::array<llvm::Constant *, 21> kluaInteger;
std::array<llvm::Constant *, 256> kByte;
llvm::Constant *kFalse;

@ -106,7 +106,9 @@ static void DumpConstants (const Proto *f, DumpState *D) {
DumpInt(n, D);
for (i = 0; i < n; i++) {
const TValue *o = &f->k[i];
DumpByte(ttype(o), D);
int tt = ttype(o);
lua_assert(tt <= 127); /* Must fit 1 byte */
DumpByte(tt, D);
switch (ttype(o)) {
case LUA_TNIL:
break;

File diff suppressed because it is too large Load Diff

@ -49,6 +49,7 @@ static const char Lua_header[] = ""
"typedef size_t lu_mem;\n"
"typedef ptrdiff_t l_mem;\n"
"typedef unsigned char lu_byte;\n"
"typedef unsigned short LuaType;\n"
"typedef union {\n"
" lua_Number n;\n"
" double u;\n"
@ -85,7 +86,7 @@ static const char Lua_header[] = ""
"#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4))\n"
"#define RAVI_TIARRAY (LUA_TTABLE | (1 << 4))\n"
"#define RAVI_TFARRAY (LUA_TTABLE | (2 << 4))\n"
"#define BIT_ISCOLLECTABLE (1 << 7)\n"
"#define BIT_ISCOLLECTABLE (1 << 15)\n"
"#define ctb(t) ((t) | BIT_ISCOLLECTABLE)\n"
"typedef struct GCObject GCObject;\n"
"#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked\n"
@ -100,7 +101,7 @@ static const char Lua_header[] = ""
" lua_Integer i;\n"
" lua_Number n;\n"
"} Value;\n"
"#define TValuefields Value value_; lu_byte tt_\n"
"#define TValuefields Value value_; LuaType tt_\n"
"typedef struct lua_TValue {\n"
" TValuefields;\n"
"} TValue;\n"
@ -243,7 +244,7 @@ static const char Lua_header[] = ""
"#define vslen(o) tsslen(tsvalue(o))\n"
"typedef struct Udata {\n"
" CommonHeader;\n"
" lu_byte ttuv_;\n"
" LuaType ttuv_;\n"
" struct Table *metatable;\n"
" size_t len;\n"
" union Value user_;\n"

@ -538,8 +538,9 @@ void RaviCodeGenerator::emit_store_type_(RaviFunctionDef *def,
lua_assert(type == LUA_TNUMFLT || type == LUA_TNUMINT ||
type == LUA_TBOOLEAN || type == LUA_TNIL);
llvm::Value *desttype = emit_gep(def, "dest.tt", value, 0, 1);
llvm::Instruction *store =
def->builder->CreateStore(def->types->kByte[type], desttype);
llvm::Instruction *store = def->builder->CreateStore(
llvm::ConstantInt::get(def->types->lua_LuaTypeT, type),
desttype);
store->setMetadata(llvm::LLVMContext::MD_tbaa, def->types->tbaa_TValue_ttT);
}
@ -555,25 +556,28 @@ llvm::Value *RaviCodeGenerator::emit_is_value_of_type(RaviFunctionDef *def,
llvm::Value *value_type,
LuaTypeCode lua_type,
const char *varname) {
return def->builder->CreateICmpEQ(value_type, def->types->kByte[int(lua_type)],
varname);
return def->builder->CreateICmpEQ(
value_type, llvm::ConstantInt::get(def->types->lua_LuaTypeT, lua_type),
varname);
}
llvm::Value *RaviCodeGenerator::emit_is_not_value_of_type(
RaviFunctionDef *def, llvm::Value *value_type, LuaTypeCode lua_type,
const char *varname) {
return def->builder->CreateICmpNE(value_type, def->types->kByte[int(lua_type)],
varname);
return def->builder->CreateICmpNE(
value_type, llvm::ConstantInt::get(def->types->lua_LuaTypeT, lua_type),
varname);
}
// Compare without variants i.e. ttnov(value_type) == lua_type
llvm::Value *RaviCodeGenerator::emit_is_not_value_of_type_class(
RaviFunctionDef *def, llvm::Value *value_type, int lua_type,
const char *varname) {
llvm::Value *novariant_type =
def->builder->CreateAnd(value_type, def->types->kByte[0x0F]);
return def->builder->CreateICmpNE(novariant_type,
def->types->kByte[int(lua_type)], varname);
llvm::Value *novariant_type = def->builder->CreateAnd(
value_type, llvm::ConstantInt::get(def->types->lua_LuaTypeT, 0x000F));
return def->builder->CreateICmpNE(
novariant_type,
llvm::ConstantInt::get(def->types->lua_LuaTypeT, lua_type), varname);
}
llvm::Instruction *RaviCodeGenerator::emit_load_ravi_arraytype(

@ -766,12 +766,15 @@ void RaviCodeGenerator::emit_SETUPVAL(RaviFunctionDef *def, int A, int B,
llvm::Value *type = emit_load_type(def, v);
llvm::Value *is_collectible =
def->builder->CreateAnd(type, def->types->kByte[BIT_ISCOLLECTABLE]);
def->builder->CreateAnd(type,
llvm::ConstantInt::get(def->types->lua_LuaTypeT, BIT_ISCOLLECTABLE));
llvm::Value *value = emit_gep_upval_value(def, upval);
llvm::Value *cmp = def->builder->CreateICmpNE(v, value, "v.ne.value");
llvm::Value *tobool = def->builder->CreateICmpEQ(
is_collectible, def->types->kByte[0], "not.collectible");
is_collectible,
llvm::ConstantInt::get(def->types->lua_LuaTypeT, 0),
"not.collectible");
llvm::Value *orcond =
def->builder->CreateOr(cmp, tobool, "v.ne.value.or.not.collectible");

@ -24,6 +24,17 @@
namespace ravi {
/* Adds the bits that are defined in macro CommonHeader in lobject.h */
void LuaLLVMTypes::addCommonGCHeader(std::vector<llvm::Type *> &elements) {
/* Common Header for all collectable objects (in macro form, to be
included in other objects)
#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
*/
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
}
LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
C_voidT = llvm::Type::getVoidTy(context);
@ -100,6 +111,8 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
lua_StateT = llvm::StructType::create(context, "struct.lua_State");
plua_StateT = llvm::PointerType::get(lua_StateT, 0);
lua_LuaTypeT = C_shortT; // Type for Lua typecode
lua_KContextT = C_ptrdiff_t;
std::vector<llvm::Type *> elements;
@ -143,9 +156,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
GCObjectT = llvm::StructType::create(context, "struct.GCObject");
pGCObjectT = llvm::PointerType::get(GCObjectT, 0);
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
GCObjectT->setBody(elements);
static_assert(sizeof(Value) == sizeof(lua_Number) &&
@ -176,7 +187,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
TValueT = llvm::StructType::create(context, "struct.TValue");
elements.clear();
elements.push_back(ValueT);
elements.push_back(lu_byteT);
elements.push_back(lua_LuaTypeT);
TValueT->setBody(elements);
pTValueT = llvm::PointerType::get(TValueT, 0);
@ -212,9 +223,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
pTStringT = llvm::PointerType::get(TStringT, 0);
ppTStringT = llvm::PointerType::get(pTStringT, 0);
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* extra */
elements.push_back(lu_byteT); /* shrlen */
elements.push_back(C_intT); /* hash */
@ -234,17 +243,15 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
// GCObject *next;
// lu_byte tt;
// lu_byte marked
// lu_byte ttuv_; /* user value's tag */
// LuaType ttuv_; /* user value's tag */
// struct Table *metatable;
// size_t len; /* number of bytes */
// union Value user_; /* user value */
//} Udata;
UdataT = llvm::StructType::create(context, "struct.Udata");
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT); /* ttuv_ */
addCommonGCHeader(elements);
elements.push_back(lua_LuaTypeT); /* ttuv_ */
elements.push_back(pTableT); /* metatable */
elements.push_back(C_size_t); /* len */
elements.push_back(ValueT); /* user_ */
@ -341,9 +348,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
pProtoT = llvm::PointerType::get(ProtoT, 0);
ppProtoT = llvm::PointerType::get(pProtoT, 0);
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* numparams */
elements.push_back(lu_byteT); /* is_vararg */
elements.push_back(lu_byteT); /* maxstacksize */
@ -388,9 +393,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
CClosureT = llvm::StructType::create(context, "struct.CClosure");
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* nupvalues */
elements.push_back(pGCObjectT); /* gclist */
elements.push_back(plua_CFunctionT); /* f */
@ -404,9 +407,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
// UpVal *upvals[1]; /* list of upvalues */
//} LClosure;
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* nupvalues */
elements.push_back(pGCObjectT); /* gclist */
elements.push_back(pProtoT); /* p */
@ -429,7 +430,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
TKeyT = llvm::StructType::create(context, "struct.TKey");
elements.clear();
elements.push_back(ValueT);
elements.push_back(lu_byteT);
elements.push_back(lua_LuaTypeT);
elements.push_back(C_intT); /* next */
TKeyT->setBody(elements);
pTKeyT = llvm::PointerType::get(TKeyT, 0);
@ -476,9 +477,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
// unsigned int hmask; /* Hash part mask (size of hash part - 1) */
//} Table;
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* flags */
elements.push_back(lu_byteT); /* lsizenode */
elements.push_back(C_intT); /* sizearray */
@ -579,10 +578,11 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
CallInfo_lT); /* u.l - as we will typically access the lua call details
*/
elements.push_back(C_ptrdiff_t); /* extra */
elements.push_back(llvm::Type::getInt16Ty(context)); /* nresults */
elements.push_back(C_shortT); /* callstatus */
elements.push_back(C_shortT); /* nresults */
elements.push_back(C_shortT); /* callstatus */
elements.push_back(C_shortT); /* stacklevel RAVI extension */
elements.push_back(lu_byteT); /* jitstatus RAVI extension*/
elements.push_back(lu_byteT); /* magic */
CallInfoT->setBody(elements);
// typedef struct ravi_State ravi_State;
@ -663,11 +663,10 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
// lu_byte hookmask;
// lu_byte allowhook;
// unsigned short nci; /* number of items in 'ci' list */
// lu_byte magic;
//};
elements.clear();
elements.push_back(pGCObjectT);
elements.push_back(lu_byteT);
elements.push_back(lu_byteT);
addCommonGCHeader(elements);
elements.push_back(lu_byteT); /* status */
elements.push_back(StkIdT); /* top */
elements.push_back(pglobal_StateT); /* l_G */
@ -685,11 +684,12 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
elements.push_back(C_intT); /* stacksize */
elements.push_back(C_intT); /* basehookcount */
elements.push_back(C_intT); /* hookcount */
elements.push_back(llvm::Type::getInt16Ty(context)); /* nny */
elements.push_back(llvm::Type::getInt16Ty(context)); /* nCcalls */
elements.push_back(C_shortT); /* nny */
elements.push_back(C_shortT); /* nCcalls */
elements.push_back(lu_byteT); /* hookmask */
elements.push_back(lu_byteT); /* allowhook */
elements.push_back(C_shortT);
elements.push_back(lu_byteT);
lua_StateT->setBody(elements);
// struct UpVal {
@ -1020,8 +1020,6 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
kInt[j] = llvm::ConstantInt::get(C_intT, j);
for (int j = 0; j < kluaInteger.size(); j++)
kluaInteger[j] = llvm::ConstantInt::get(lua_IntegerT, j);
for (int j = 0; j < kByte.size(); j++)
kByte[j] = llvm::ConstantInt::get(lu_byteT, j);
kFalse = llvm::ConstantInt::getFalse(llvm::Type::getInt1Ty(context));
// Do what Clang does
@ -1243,7 +1241,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
nodes.clear();
nodes.push_back(std::pair<llvm::MDNode *, uint64_t>(tbaa_longlongT, 0));
nodes.push_back(std::pair<llvm::MDNode *, uint64_t>(tbaa_charT, 8));
nodes.push_back(std::pair<llvm::MDNode *, uint64_t>(tbaa_shortT, 8));
tbaa_TValueT = mdbuilder.createTBAAStructTypeNode("TValue", nodes);
tbaa_TValue_nT =
@ -1251,7 +1249,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
tbaa_TValue_hT =
mdbuilder.createTBAAStructTagNode(tbaa_pointerT, tbaa_pointerT, 0);
tbaa_TValue_ttT =
mdbuilder.createTBAAStructTagNode(tbaa_TValueT, tbaa_charT, 8);
mdbuilder.createTBAAStructTagNode(tbaa_TValueT, tbaa_shortT, 8);
tbaa_luaState_topT =
mdbuilder.createTBAAStructTagNode(tbaa_luaStateT, tbaa_pointerT, 8);

Loading…
Cancel
Save