Skip to content

Instantly share code, notes, and snippets.

@nikic

nikic/reduced.ll Secret

Created November 27, 2020 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikic/bc0e46b99555c93995d07c55cb4f8420 to your computer and use it in GitHub Desktop.
Save nikic/bc0e46b99555c93995d07c55cb4f8420 to your computer and use it in GitHub Desktop.
; ModuleID = 'reduced.ll'
source_filename = "test.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@dv_init_weight_tables.dv100_qstep = internal constant [16 x i8] c"\01\01\02\03\04\05\06\07\08\10\12\14\16\18\1C4", align 16
@dv_iweight_720_y = internal constant [64 x i16] [i16 128, i16 16, i16 16, i16 17, i16 17, i16 17, i16 18, i16 18, i16 18, i16 18, i16 18, i16 18, i16 19, i16 18, i16 18, i16 19, i16 19, i16 19, i16 19, i16 19, i16 19, i16 42, i16 38, i16 40, i16 40, i16 40, i16 38, i16 42, i16 44, i16 43, i16 41, i16 41, i16 41, i16 41, i16 43, i16 44, i16 68, i16 68, i16 63, i16 63, i16 63, i16 68, i16 68, i16 96, i16 92, i16 86, i16 86, i16 92, i16 96, i16 98, i16 96, i16 88, i16 96, i16 98, i16 202, i16 196, i16 196, i16 202, i16 208, i16 218, i16 208, i16 232, i16 232, i16 246], align 16
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0
; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1
define void @dv_init_weight_tables() {
entry:
%i = alloca i32, align 4
%c = alloca i32, align 4
%s = alloca i32, align 4
%factor1 = alloca i32*, align 8
%factor2 = alloca i32*, align 8
%iweight1 = alloca i16*, align 8
br label %if.then
if.then: ; preds = %entry
br label %if.then6
if.then6: ; preds = %if.then
store i16* getelementptr inbounds ([64 x i16], [64 x i16]* @dv_iweight_720_y, i64 0, i64 0), i16** %iweight1, align 8
br label %if.end
if.end: ; preds = %if.then6
br label %for.cond
for.cond: ; preds = %for.inc32, %if.end
br label %for.body
for.body: ; preds = %for.cond
store i32 0, i32* %s, align 4
br label %for.cond8
for.cond8: ; preds = %for.inc29, %for.body
%0 = load i32, i32* %s, align 4
%cmp9 = icmp slt i32 %0, 16
br i1 %cmp9, label %for.body10, label %for.end31
for.body10: ; preds = %for.cond8
store i32 0, i32* %i, align 4
br label %for.cond11
for.cond11: ; preds = %for.inc, %for.body10
%1 = load i32, i32* %i, align 4
%cmp12 = icmp slt i32 %1, 64
br i1 %cmp12, label %for.body13, label %for.end
for.body13: ; preds = %for.cond11
%2 = load i32, i32* %s, align 4
%idxprom14 = sext i32 %2 to i64
%arrayidx15 = getelementptr inbounds [16 x i8], [16 x i8]* @dv_init_weight_tables.dv100_qstep, i64 0, i64 %idxprom14
%3 = load i8, i8* %arrayidx15, align 1
%conv = zext i8 %3 to i32
%4 = load i32, i32* %c, align 4
%add = add nsw i32 %4, 9
%shl = shl i32 %conv, %add
%5 = load i16*, i16** %iweight1, align 8
%6 = load i32, i32* %i, align 4
%idxprom16 = sext i32 %6 to i64
%arrayidx17 = getelementptr inbounds i16, i16* %5, i64 %idxprom16
%7 = load i16, i16* %arrayidx17, align 2
%conv18 = zext i16 %7 to i32
%mul = mul nsw i32 %shl, %conv18
%8 = load i32*, i32** %factor1, align 8
%incdec.ptr = getelementptr inbounds i32, i32* %8, i32 1
store i32* %incdec.ptr, i32** %factor1, align 8
store i32 %mul, i32* %8, align 4
%conv26 = zext i16 undef to i32
%mul27 = mul nsw i32 undef, %conv26
%9 = load i32*, i32** %factor2, align 8
%incdec.ptr28 = getelementptr inbounds i32, i32* %9, i32 1
store i32* %incdec.ptr28, i32** %factor2, align 8
store i32 %mul27, i32* %9, align 4
br label %for.inc
for.inc: ; preds = %for.body13
%10 = load i32, i32* %i, align 4
%inc = add nsw i32 %10, 1
store i32 %inc, i32* %i, align 4
br label %for.cond11
for.end: ; preds = %for.cond11
br label %for.inc29
for.inc29: ; preds = %for.end
%11 = load i32, i32* %s, align 4
%inc30 = add nsw i32 %11, 1
store i32 %inc30, i32* %s, align 4
br label %for.cond8
for.end31: ; preds = %for.cond8
br label %for.inc32
for.inc32: ; preds = %for.end31
%12 = load i32, i32* %c, align 4
%inc33 = add nsw i32 %12, 1
store i32 %inc33, i32* %c, align 4
br label %for.cond
}
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0
attributes #0 = { argmemonly nofree nosync nounwind willreturn }
attributes #1 = { argmemonly nofree nosync nounwind willreturn writeonly }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment