123 lines
4.8 KiB
LLVM
123 lines
4.8 KiB
LLVM
|
; ModuleID = 'prime.c'
|
||
|
source_filename = "prime.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-pc-linux-gnu"
|
||
|
|
||
|
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone sspstrong uwtable willreturn
|
||
|
define dso_local zeroext i8 @divides(i32 %0, i32 %1) local_unnamed_addr #0 {
|
||
|
%3 = urem i32 %1, %0
|
||
|
%4 = icmp eq i32 %3, 0
|
||
|
%5 = zext i1 %4 to i8
|
||
|
ret i8 %5
|
||
|
}
|
||
|
|
||
|
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone sspstrong uwtable willreturn
|
||
|
define dso_local zeroext i8 @even(i32 %0) local_unnamed_addr #0 {
|
||
|
%2 = trunc i32 %0 to i8
|
||
|
%3 = and i8 %2, 1
|
||
|
%4 = xor i8 %3, 1
|
||
|
ret i8 %4
|
||
|
}
|
||
|
|
||
|
; Function Attrs: nofree norecurse nosync nounwind readnone sspstrong uwtable
|
||
|
define dso_local zeroext i8 @prime(i32 %0) local_unnamed_addr #1 {
|
||
|
%2 = and i32 %0, 1
|
||
|
%3 = icmp eq i32 %2, 0
|
||
|
br i1 %3, label %6, label %4
|
||
|
|
||
|
4: ; preds = %1
|
||
|
%5 = icmp ult i32 %0, 9
|
||
|
br i1 %5, label %16, label %11
|
||
|
|
||
|
6: ; preds = %1
|
||
|
%7 = icmp eq i32 %0, 2
|
||
|
br label %18
|
||
|
|
||
|
8: ; preds = %11
|
||
|
%9 = mul i32 %15, %15
|
||
|
%10 = icmp ugt i32 %9, %0
|
||
|
br i1 %10, label %16, label %11, !llvm.loop !5
|
||
|
|
||
|
11: ; preds = %4, %8
|
||
|
%12 = phi i32 [ %15, %8 ], [ 3, %4 ]
|
||
|
%13 = urem i32 %0, %12
|
||
|
%14 = icmp eq i32 %13, 0
|
||
|
%15 = add i32 %12, 2
|
||
|
br i1 %14, label %18, label %8
|
||
|
|
||
|
16: ; preds = %8, %4
|
||
|
%17 = icmp ugt i32 %0, 1
|
||
|
br label %18
|
||
|
|
||
|
18: ; preds = %11, %16, %6
|
||
|
%19 = phi i1 [ %7, %6 ], [ %17, %16 ], [ false, %11 ]
|
||
|
%20 = zext i1 %19 to i8
|
||
|
ret i8 %20
|
||
|
}
|
||
|
|
||
|
; Function Attrs: mustprogress nofree norecurse nosync nounwind sspstrong uwtable willreturn
|
||
|
define dso_local void @swap(i32* nocapture %0, i32* nocapture %1) local_unnamed_addr #2 {
|
||
|
%3 = load i32, i32* %0, align 4, !tbaa !8
|
||
|
%4 = load i32, i32* %1, align 4, !tbaa !8
|
||
|
store i32 %4, i32* %0, align 4, !tbaa !8
|
||
|
store i32 %3, i32* %1, align 4, !tbaa !8
|
||
|
ret void
|
||
|
}
|
||
|
|
||
|
; Function Attrs: nofree nosync nounwind readnone sspstrong uwtable
|
||
|
define dso_local i32 @main() local_unnamed_addr #3 {
|
||
|
br label %1
|
||
|
|
||
|
1: ; preds = %1, %0
|
||
|
%2 = phi i32 [ 3, %0 ], [ %5, %1 ]
|
||
|
%3 = urem i32 513239, %2
|
||
|
%4 = icmp eq i32 %3, 0
|
||
|
%5 = add nuw nsw i32 %2, 2
|
||
|
%6 = mul i32 %5, %5
|
||
|
%7 = icmp ugt i32 %6, 513239
|
||
|
%8 = select i1 %4, i1 true, i1 %7
|
||
|
br i1 %8, label %9, label %1, !llvm.loop !5
|
||
|
|
||
|
9: ; preds = %1
|
||
|
br i1 %4, label %20, label %10
|
||
|
|
||
|
10: ; preds = %9, %10
|
||
|
%11 = phi i32 [ %14, %10 ], [ 3, %9 ]
|
||
|
%12 = urem i32 21649, %11
|
||
|
%13 = icmp eq i32 %12, 0
|
||
|
%14 = add nuw nsw i32 %11, 2
|
||
|
%15 = mul i32 %14, %14
|
||
|
%16 = icmp ugt i32 %15, 21649
|
||
|
%17 = select i1 %13, i1 true, i1 %16
|
||
|
br i1 %17, label %18, label %10, !llvm.loop !5
|
||
|
|
||
|
18: ; preds = %10
|
||
|
%19 = zext i1 %13 to i32
|
||
|
br label %20
|
||
|
|
||
|
20: ; preds = %18, %9
|
||
|
%21 = phi i32 [ 1, %9 ], [ %19, %18 ]
|
||
|
ret i32 %21
|
||
|
}
|
||
|
|
||
|
attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone sspstrong uwtable willreturn "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
|
||
|
attributes #1 = { nofree norecurse nosync nounwind readnone sspstrong uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
|
||
|
attributes #2 = { mustprogress nofree norecurse nosync nounwind sspstrong uwtable willreturn "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
|
||
|
attributes #3 = { nofree nosync nounwind readnone sspstrong uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
|
||
|
|
||
|
!llvm.module.flags = !{!0, !1, !2, !3}
|
||
|
!llvm.ident = !{!4}
|
||
|
|
||
|
!0 = !{i32 1, !"wchar_size", i32 4}
|
||
|
!1 = !{i32 7, !"PIC Level", i32 2}
|
||
|
!2 = !{i32 7, !"PIE Level", i32 2}
|
||
|
!3 = !{i32 7, !"uwtable", i32 1}
|
||
|
!4 = !{!"clang version 13.0.1"}
|
||
|
!5 = distinct !{!5, !6, !7}
|
||
|
!6 = !{!"llvm.loop.mustprogress"}
|
||
|
!7 = !{!"llvm.loop.unroll.disable"}
|
||
|
!8 = !{!9, !9, i64 0}
|
||
|
!9 = !{!"int", !10, i64 0}
|
||
|
!10 = !{!"omnipotent char", !11, i64 0}
|
||
|
!11 = !{!"Simple C/C++ TBAA"}
|