Skip to content

Instantly share code, notes, and snippets.

@jgouly
Created September 11, 2014 17:28
Show Gist options
  • Save jgouly/dc27d6d6a240eec9f469 to your computer and use it in GitHub Desktop.
Save jgouly/dc27d6d6a240eec9f469 to your computer and use it in GitHub Desktop.
;; Original from: http://is.gd/WxkPFL
; ModuleID = 'rust-out.0.rs'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@vtable1267 = internal constant { void (i8*)*, i64, i64, i64 ({}*, i64)* } { void (i8*)* @_ZN2i814glue_drop.126517h59f3793ece30fe9eE, i64 8, i64 8, i64 ({}*, i64)* @"_ZN14_$LP$$RP$.Many6switch20h6ca796108d9da36e9aaE" }
; Function Attrs: nounwind readnone uwtable
define i64 @"_ZN14_$LP$$RP$.Many6switch20h6ca796108d9da36e9aaE"({}* noalias nocapture readonly, i64) unnamed_addr #0 {
entry-block:
%2 = icmp eq i64 %1, -4643972648086929078
br i1 %2, label %join6, label %else-block
else-block: ; preds = %entry-block
%3 = icmp eq i64 %1, -6187814810684708707
br i1 %3, label %join6, label %else-block1
else-block1: ; preds = %else-block
%4 = icmp eq i64 %1, -2452956007213319029
br i1 %4, label %join6, label %else-block2
else-block2: ; preds = %else-block1
%5 = icmp eq i64 %1, -1884880784014257656
%. = select i1 %5, i64 -1884880784014257656, i64 -8405392928520026739
ret i64 %.
join6: ; preds = %else-block1, %else-block, %entry-block
%sret_slot.0 = phi i64 [ -4643972648086929078, %entry-block ], [ -6187814810684708707, %else-block ], [ -2452956007213319029, %else-block1 ]
ret i64 %sret_slot.0
}
; Function Attrs: nounwind uwtable
define void @_ZN3foo20h467ac5ab87fb9a396caE({ i8*, void (i8*)** }* noalias nocapture sret dereferenceable(16), {}* noalias nocapture readonly) unnamed_addr #1 {
entry-block:
%2 = getelementptr inbounds { i8*, void (i8*)** }* %0, i64 0, i32 0
%.c = bitcast {}* %1 to i8*
store i8* %.c, i8** %2, align 8
%.sroa.3.0..sroa_idx = getelementptr inbounds { i8*, void (i8*)** }* %0, i64 0, i32 1
store void (i8*)** getelementptr inbounds ({ void (i8*)*, i64, i64, i64 ({}*, i64)* }* @vtable1267, i64 0, i32 0), void (i8*)*** %.sroa.3.0..sroa_idx, align 8
ret void
}
; Function Attrs: nounwind readnone
define internal void @_ZN2i814glue_drop.126517h59f3793ece30fe9eE(i8* nocapture) unnamed_addr #2 {
entry-block:
ret void
}
attributes #0 = { nounwind readnone uwtable "split-stack" }
attributes #1 = { nounwind uwtable "split-stack" }
attributes #2 = { nounwind readnone "split-stack" }
;;;;;;;;;;;;;;;;;;;
;;;;; changed to
; ModuleID = 'rust-out.0.rs'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readnone uwtable
define i64 @"_ZN14_$LP$$RP$.Many6switch20h6ca796108d9da36e9aaE"({}* noalias nocapture readonly, i64) unnamed_addr #0 {
entry-block:
%2 = icmp eq i64 %1, -4643972648086929078
br i1 %2, label %e1, label %else-block
e1:
br label %join6
else-block: ; preds = %entry-block
%3 = icmp eq i64 %1, -6187814810684708707
br i1 %3, label %e2, label %else-block1
e2:
br label %join6
else-block1: ; preds = %else-block
%4 = icmp eq i64 %1, -2452956007213319029
br i1 %4, label %e3, label %else-block2
e3:
br label %join6
else-block2: ; preds = %else-block1
%5 = icmp eq i64 %1, -1884880784014257656
%. = select i1 %5, i64 -1884880784014257656, i64 -8405392928520026739
ret i64 %.
join6: ; preds = %else-block1, %else-block, %entry-block
%sret_slot.0 = phi i64 [ -4643972648086929078, %e1 ], [ -6187814810684708707, %e2 ], [ -2452956007213319029, %e3 ]
ret i64 %sret_slot.0
}
attributes #0 = { nounwind readnone uwtable "split-stack" }
attributes #1 = { nounwind uwtable "split-stack" }
attributes #2 = { nounwind readnone "split-stack" }
;;;;;;;;;
;;; optimised to
;;;;;;;
; ModuleID = 'eddy.ll'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readnone uwtable
define i64 @"_ZN14_$LP$$RP$.Many6switch20h6ca796108d9da36e9aaE"({}* noalias nocapture readonly, i64) unnamed_addr #0 {
entry-block:
switch i64 %1, label %else-block2 [
i64 -4643972648086929078, label %join6
i64 -6187814810684708707, label %e2
i64 -2452956007213319029, label %e3
]
e2: ; preds = %entry-block
br label %join6
e3: ; preds = %entry-block
br label %join6
else-block2: ; preds = %entry-block
%2 = icmp eq i64 %1, -1884880784014257656
%. = select i1 %2, i64 -1884880784014257656, i64 -8405392928520026739
ret i64 %.
join6: ; preds = %entry-block, %e3, %e2
%sret_slot.0 = phi i64 [ %1, %e2 ], [ %1, %e3 ], [ -4643972648086929078, %entry-block ]
ret i64 %sret_slot.0
}
attributes #0 = { nounwind readnone uwtable "split-stack" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment