Skip to content

Instantly share code, notes, and snippets.

@fsaintjacques
Created February 13, 2020 15:24
Show Gist options
  • Save fsaintjacques/a0581cd9e50ba614f9cea5fbdfd2d124 to your computer and use it in GitHub Desktop.
Save fsaintjacques/a0581cd9e50ba614f9cea5fbdfd2d124 to your computer and use it in GitHub Desktop.
gandiva filter
; ModuleID = 'codegen'
source_filename = "codegen"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
@_ZN5arrow7BitUtilL8kBitmaskE = internal unnamed_addr constant [8 x i8] c"\01\02\04\08\10 @\80", align 1
; Function Attrs: norecurse nounwind
define i32 @expr_0_0(i64* nocapture readonly %args, i64* nocapture readonly %arg_addr_offsets, i64* nocapture readnone %local_bitmaps, i16* nocapture readnone %selection_vector, i64 %context_ptr, i64 %nrecords) local_unnamed_addr #0 {
entry:
%0 = bitcast i64* %args to i8**
%cond_mem56 = load i8*, i8** %0, align 8
%1 = getelementptr i64, i64* %arg_addr_offsets, i64 3
%2 = load i64, i64* %1, align 8
%a_mem_addr = getelementptr i64, i64* %args, i64 3
%3 = bitcast i64* %a_mem_addr to double**
%a_mem7 = load double*, double** %3, align 8
%scevgep = getelementptr double, double* %a_mem7, i64 %2
br label %loop
loop: ; preds = %loop, %entry
%loop_var = phi i64 [ 0, %entry ], [ %"loop_var+1", %loop ]
%scevgep8 = getelementptr double, double* %scevgep, i64 %loop_var
%a = load double, double* %scevgep8, align 8
%4 = fcmp olt double %a, 1.000000e+03
%5 = sext i1 %4 to i8
%.udiv = lshr i64 %loop_var, 3
%6 = getelementptr inbounds i8, i8* %cond_mem56, i64 %.udiv
%7 = load i8, i8* %6, align 1, !tbaa !2
%8 = xor i8 %7, %5
%.urem = and i64 %loop_var, 7
%9 = getelementptr inbounds [8 x i8], [8 x i8]* @_ZN5arrow7BitUtilL8kBitmaskE, i64 0, i64 %.urem
%10 = load i8, i8* %9, align 1, !tbaa !2
%11 = and i8 %8, %10
%12 = xor i8 %11, %7
store i8 %12, i8* %6, align 1, !tbaa !2
%"loop_var+1" = add nuw nsw i64 %loop_var, 1
%"loop_var < nrec" = icmp slt i64 %"loop_var+1", %nrecords
br i1 %"loop_var < nrec", label %loop, label %exit
exit: ; preds = %loop
ret i32 0
}
attributes #0 = { norecurse nounwind }
!llvm.ident = !{!0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0}
!llvm.module.flags = !{!1}
!0 = !{!"clang version 7.0.0 (tags/RELEASE_700/final)"}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{!3, !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C++ TBAA"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment