Created
September 30, 2015 09:30
-
-
Save ranma42/d2e6d50999e801ffd4ed to your computer and use it in GitHub Desktop.
Experiments with removal of identical code blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'enum4.0.rs' | |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-apple-darwin" | |
%E32 = type { i32, [0 x i32], [1 x i32] } | |
; Function Attrs: inlinehint nounwind readonly uwtable | |
define zeroext i1 @_ZN25E32...std..cmp..PartialEq2eq20h5da5b35084c7cd82taaE(%E32* noalias nocapture readonly dereferenceable(8), %E32* noalias nocapture readonly dereferenceable(8)) unnamed_addr #0 { | |
entry-block: | |
%2 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 0 | |
%3 = load i32, i32* %2, align 4 | |
%4 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 0 | |
%5 = load i32, i32* %4, align 4, !range !0 | |
%6 = icmp eq i32 %3, %5 | |
br i1 %6, label %then-block-62-, label %join31 | |
then-block-62-: ; preds = %entry-block | |
switch i32 %3, label %match_else [ | |
i32 0, label %match_case | |
i32 1, label %match_case13 | |
i32 2, label %match_case16 | |
i32 3, label %match_case19 | |
] | |
match_else: ; preds = %then-block-62- | |
unreachable | |
match_case: ; preds = %then-block-62- | |
%7 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%8 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%9 = load i32, i32* %8, align 4 | |
%10 = load i32, i32* %7, align 4 | |
%11 = icmp eq i32 %9, %10 | |
%12 = zext i1 %11 to i8 | |
br label %join31 | |
match_case13: ; preds = %then-block-62- | |
%13 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%14 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%15 = load i32, i32* %14, align 4 | |
%16 = load i32, i32* %13, align 4 | |
%17 = icmp eq i32 %15, %16 | |
%18 = zext i1 %17 to i8 | |
br label %join31 | |
match_case16: ; preds = %then-block-62- | |
%19 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%20 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%21 = load i32, i32* %20, align 4 | |
%22 = load i32, i32* %19, align 4 | |
%23 = icmp eq i32 %21, %22 | |
%24 = zext i1 %23 to i8 | |
br label %join31 | |
match_case19: ; preds = %then-block-62- | |
%25 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%26 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%27 = load i32, i32* %26, align 4 | |
%28 = load i32, i32* %25, align 4 | |
%29 = icmp eq i32 %27, %28 | |
%30 = zext i1 %29 to i8 | |
br label %join31 | |
join31: ; preds = %entry-block, %match_case, %match_case13, %match_case16, %match_case19 | |
%sret_slot.1 = phi i8 [ %30, %match_case19 ], [ %24, %match_case16 ], [ %18, %match_case13 ], [ %12, %match_case ], [ 0, %entry-block ] | |
%31 = icmp ne i8 %sret_slot.1, 0 | |
ret i1 %31 | |
} | |
; Function Attrs: inlinehint nounwind readonly uwtable | |
define zeroext i1 @_ZN25E32...std..cmp..PartialEq2ne20h774474656f125cdbtcaE(%E32* noalias nocapture readonly dereferenceable(8), %E32* noalias nocapture readonly dereferenceable(8)) unnamed_addr #0 { | |
entry-block: | |
%2 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 0 | |
%3 = load i32, i32* %2, align 4 | |
%4 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 0 | |
%5 = load i32, i32* %4, align 4, !range !0 | |
%6 = icmp eq i32 %3, %5 | |
br i1 %6, label %then-block-186-, label %join31 | |
then-block-186-: ; preds = %entry-block | |
switch i32 %3, label %match_else [ | |
i32 0, label %match_case | |
i32 1, label %match_case13 | |
i32 2, label %match_case16 | |
i32 3, label %match_case19 | |
] | |
match_else: ; preds = %then-block-186- | |
unreachable | |
match_case: ; preds = %then-block-186- | |
%7 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%8 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%9 = load i32, i32* %8, align 4 | |
%10 = load i32, i32* %7, align 4 | |
%11 = icmp ne i32 %9, %10 | |
%12 = zext i1 %11 to i8 | |
br label %join31 | |
match_case13: ; preds = %then-block-186- | |
%13 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%14 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%15 = load i32, i32* %14, align 4 | |
%16 = load i32, i32* %13, align 4 | |
%17 = icmp ne i32 %15, %16 | |
%18 = zext i1 %17 to i8 | |
br label %join31 | |
match_case16: ; preds = %then-block-186- | |
%19 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%20 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%21 = load i32, i32* %20, align 4 | |
%22 = load i32, i32* %19, align 4 | |
%23 = icmp ne i32 %21, %22 | |
%24 = zext i1 %23 to i8 | |
br label %join31 | |
match_case19: ; preds = %then-block-186- | |
%25 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%26 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%27 = load i32, i32* %26, align 4 | |
%28 = load i32, i32* %25, align 4 | |
%29 = icmp ne i32 %27, %28 | |
%30 = zext i1 %29 to i8 | |
br label %join31 | |
join31: ; preds = %entry-block, %match_case, %match_case13, %match_case16, %match_case19 | |
%sret_slot.1 = phi i8 [ %30, %match_case19 ], [ %24, %match_case16 ], [ %18, %match_case13 ], [ %12, %match_case ], [ 1, %entry-block ] | |
%31 = icmp ne i8 %sret_slot.1, 0 | |
ret i1 %31 | |
} | |
attributes #0 = { inlinehint nounwind readonly uwtable "no-frame-pointer-elim"="true" } | |
!0 = !{i32 0, i32 4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(PartialEq)] | |
enum E32 { | |
A(i32), | |
B(i32), | |
C(i32), | |
D(i32), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section __TEXT,__text,regular,pure_instructions | |
.globl __ZN25E32...std..cmp..PartialEq2eq20h5da5b35084c7cd82taaE | |
.align 4, 0x90 | |
__ZN25E32...std..cmp..PartialEq2eq20h5da5b35084c7cd82taaE: | |
.cfi_startproc | |
pushq %rbp | |
Ltmp0: | |
.cfi_def_cfa_offset 16 | |
Ltmp1: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
Ltmp2: | |
.cfi_def_cfa_register %rbp | |
movl (%rdi), %eax | |
cmpl (%rsi), %eax | |
jne LBB0_1 | |
cmpl $1, %eax | |
je LBB0_5 | |
cmpl $2, %eax | |
je LBB0_5 | |
cmpl $3, %eax | |
LBB0_5: | |
movl 4(%rdi), %eax | |
cmpl 4(%rsi), %eax | |
sete %al | |
popq %rbp | |
retq | |
LBB0_1: | |
xorl %eax, %eax | |
popq %rbp | |
retq | |
.cfi_endproc | |
.globl __ZN25E32...std..cmp..PartialEq2ne20h774474656f125cdbtcaE | |
.align 4, 0x90 | |
__ZN25E32...std..cmp..PartialEq2ne20h774474656f125cdbtcaE: | |
.cfi_startproc | |
pushq %rbp | |
Ltmp3: | |
.cfi_def_cfa_offset 16 | |
Ltmp4: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
Ltmp5: | |
.cfi_def_cfa_register %rbp | |
movl (%rdi), %ecx | |
movb $1, %al | |
cmpl (%rsi), %ecx | |
jne LBB1_5 | |
cmpl $1, %ecx | |
je LBB1_4 | |
cmpl $2, %ecx | |
je LBB1_4 | |
cmpl $3, %ecx | |
LBB1_4: | |
movl 4(%rdi), %eax | |
cmpl 4(%rsi), %eax | |
setne %al | |
LBB1_5: | |
popq %rbp | |
retq | |
.cfi_endproc | |
.subsections_via_symbols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'enum6.0.rs' | |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-apple-darwin" | |
%E32 = type { i32, [0 x i32], [1 x i32] } | |
; Function Attrs: inlinehint nounwind readonly uwtable | |
define zeroext i1 @_ZN25E32...std..cmp..PartialEq2eq20h3ce5a9f8c3e0711czaaE(%E32* noalias nocapture readonly dereferenceable(8), %E32* noalias nocapture readonly dereferenceable(8)) unnamed_addr #0 { | |
entry-block: | |
%2 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 0 | |
%3 = load i32, i32* %2, align 4 | |
%4 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 0 | |
%5 = load i32, i32* %4, align 4, !range !0 | |
%6 = icmp eq i32 %3, %5 | |
br i1 %6, label %then-block-68-, label %join47 | |
then-block-68-: ; preds = %entry-block | |
switch i32 %3, label %match_else [ | |
i32 0, label %match_case | |
i32 1, label %match_case19 | |
i32 2, label %match_case22 | |
i32 3, label %match_case25 | |
i32 4, label %match_case28 | |
i32 5, label %match_case31 | |
] | |
match_else: ; preds = %then-block-68- | |
unreachable | |
match_case: ; preds = %then-block-68- | |
%7 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%8 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%9 = load i32, i32* %8, align 4 | |
%10 = load i32, i32* %7, align 4 | |
%11 = icmp eq i32 %9, %10 | |
%12 = zext i1 %11 to i8 | |
br label %join47 | |
match_case19: ; preds = %then-block-68- | |
%13 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%14 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%15 = load i32, i32* %14, align 4 | |
%16 = load i32, i32* %13, align 4 | |
%17 = icmp eq i32 %15, %16 | |
%18 = zext i1 %17 to i8 | |
br label %join47 | |
match_case22: ; preds = %then-block-68- | |
%19 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%20 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%21 = load i32, i32* %20, align 4 | |
%22 = load i32, i32* %19, align 4 | |
%23 = icmp eq i32 %21, %22 | |
%24 = zext i1 %23 to i8 | |
br label %join47 | |
match_case25: ; preds = %then-block-68- | |
%25 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%26 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%27 = load i32, i32* %26, align 4 | |
%28 = load i32, i32* %25, align 4 | |
%29 = icmp eq i32 %27, %28 | |
%30 = zext i1 %29 to i8 | |
br label %join47 | |
match_case28: ; preds = %then-block-68- | |
%31 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%32 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%33 = load i32, i32* %32, align 4 | |
%34 = load i32, i32* %31, align 4 | |
%35 = icmp eq i32 %33, %34 | |
%36 = zext i1 %35 to i8 | |
br label %join47 | |
match_case31: ; preds = %then-block-68- | |
%37 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%38 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%39 = load i32, i32* %38, align 4 | |
%40 = load i32, i32* %37, align 4 | |
%41 = icmp eq i32 %39, %40 | |
%42 = zext i1 %41 to i8 | |
br label %join47 | |
join47: ; preds = %entry-block, %match_case, %match_case19, %match_case22, %match_case25, %match_case28, %match_case31 | |
%sret_slot.1 = phi i8 [ %42, %match_case31 ], [ %36, %match_case28 ], [ %30, %match_case25 ], [ %24, %match_case22 ], [ %18, %match_case19 ], [ %12, %match_case ], [ 0, %entry-block ] | |
%43 = icmp ne i8 %sret_slot.1, 0 | |
ret i1 %43 | |
} | |
; Function Attrs: inlinehint nounwind readonly uwtable | |
define zeroext i1 @_ZN25E32...std..cmp..PartialEq2ne20h466d9e465495acac5caE(%E32* noalias nocapture readonly dereferenceable(8), %E32* noalias nocapture readonly dereferenceable(8)) unnamed_addr #0 { | |
entry-block: | |
%2 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 0 | |
%3 = load i32, i32* %2, align 4 | |
%4 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 0 | |
%5 = load i32, i32* %4, align 4, !range !0 | |
%6 = icmp eq i32 %3, %5 | |
br i1 %6, label %then-block-224-, label %join47 | |
then-block-224-: ; preds = %entry-block | |
switch i32 %3, label %match_else [ | |
i32 0, label %match_case | |
i32 1, label %match_case19 | |
i32 2, label %match_case22 | |
i32 3, label %match_case25 | |
i32 4, label %match_case28 | |
i32 5, label %match_case31 | |
] | |
match_else: ; preds = %then-block-224- | |
unreachable | |
match_case: ; preds = %then-block-224- | |
%7 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%8 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%9 = load i32, i32* %8, align 4 | |
%10 = load i32, i32* %7, align 4 | |
%11 = icmp ne i32 %9, %10 | |
%12 = zext i1 %11 to i8 | |
br label %join47 | |
match_case19: ; preds = %then-block-224- | |
%13 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%14 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%15 = load i32, i32* %14, align 4 | |
%16 = load i32, i32* %13, align 4 | |
%17 = icmp ne i32 %15, %16 | |
%18 = zext i1 %17 to i8 | |
br label %join47 | |
match_case22: ; preds = %then-block-224- | |
%19 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%20 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%21 = load i32, i32* %20, align 4 | |
%22 = load i32, i32* %19, align 4 | |
%23 = icmp ne i32 %21, %22 | |
%24 = zext i1 %23 to i8 | |
br label %join47 | |
match_case25: ; preds = %then-block-224- | |
%25 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%26 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%27 = load i32, i32* %26, align 4 | |
%28 = load i32, i32* %25, align 4 | |
%29 = icmp ne i32 %27, %28 | |
%30 = zext i1 %29 to i8 | |
br label %join47 | |
match_case28: ; preds = %then-block-224- | |
%31 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%32 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%33 = load i32, i32* %32, align 4 | |
%34 = load i32, i32* %31, align 4 | |
%35 = icmp ne i32 %33, %34 | |
%36 = zext i1 %35 to i8 | |
br label %join47 | |
match_case31: ; preds = %then-block-224- | |
%37 = getelementptr inbounds %E32, %E32* %1, i64 0, i32 2, i64 0 | |
%38 = getelementptr inbounds %E32, %E32* %0, i64 0, i32 2, i64 0 | |
%39 = load i32, i32* %38, align 4 | |
%40 = load i32, i32* %37, align 4 | |
%41 = icmp ne i32 %39, %40 | |
%42 = zext i1 %41 to i8 | |
br label %join47 | |
join47: ; preds = %entry-block, %match_case, %match_case19, %match_case22, %match_case25, %match_case28, %match_case31 | |
%sret_slot.1 = phi i8 [ %42, %match_case31 ], [ %36, %match_case28 ], [ %30, %match_case25 ], [ %24, %match_case22 ], [ %18, %match_case19 ], [ %12, %match_case ], [ 1, %entry-block ] | |
%43 = icmp ne i8 %sret_slot.1, 0 | |
ret i1 %43 | |
} | |
attributes #0 = { inlinehint nounwind readonly uwtable "no-frame-pointer-elim"="true" } | |
!0 = !{i32 0, i32 6} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(PartialEq)] | |
enum E32 { | |
A(i32), | |
B(i32), | |
C(i32), | |
D(i32), | |
E(i32), | |
F(i32), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section __TEXT,__text,regular,pure_instructions | |
.globl __ZN25E32...std..cmp..PartialEq2eq20h3ce5a9f8c3e0711czaaE | |
.align 4, 0x90 | |
__ZN25E32...std..cmp..PartialEq2eq20h3ce5a9f8c3e0711czaaE: | |
.cfi_startproc | |
pushq %rbp | |
Ltmp0: | |
.cfi_def_cfa_offset 16 | |
Ltmp1: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
Ltmp2: | |
.cfi_def_cfa_register %rbp | |
movl (%rdi), %eax | |
cmpl (%rsi), %eax | |
jne LBB0_1 | |
decl %eax | |
cmpl $4, %eax | |
jbe LBB0_3 | |
LBB0_4: | |
movl 4(%rdi), %eax | |
cmpl 4(%rsi), %eax | |
sete %al | |
popq %rbp | |
retq | |
LBB0_1: | |
xorl %eax, %eax | |
popq %rbp | |
retq | |
LBB0_3: | |
leaq LJTI0_0(%rip), %rcx | |
movslq (%rcx,%rax,4), %rax | |
addq %rcx, %rax | |
jmpq *%rax | |
.cfi_endproc | |
.align 2, 0x90 | |
L0_0_set_4 = LBB0_4-LJTI0_0 | |
LJTI0_0: | |
.long L0_0_set_4 | |
.long L0_0_set_4 | |
.long L0_0_set_4 | |
.long L0_0_set_4 | |
.long L0_0_set_4 | |
.globl __ZN25E32...std..cmp..PartialEq2ne20h466d9e465495acac5caE | |
.align 4, 0x90 | |
__ZN25E32...std..cmp..PartialEq2ne20h466d9e465495acac5caE: | |
.cfi_startproc | |
pushq %rbp | |
Ltmp3: | |
.cfi_def_cfa_offset 16 | |
Ltmp4: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
Ltmp5: | |
.cfi_def_cfa_register %rbp | |
movl (%rdi), %ecx | |
movb $1, %al | |
cmpl (%rsi), %ecx | |
jne LBB1_4 | |
decl %ecx | |
cmpl $4, %ecx | |
jbe LBB1_2 | |
LBB1_3: | |
movl 4(%rdi), %eax | |
cmpl 4(%rsi), %eax | |
setne %al | |
LBB1_4: | |
popq %rbp | |
retq | |
LBB1_2: | |
leaq LJTI1_0(%rip), %rax | |
movslq (%rax,%rcx,4), %rcx | |
addq %rax, %rcx | |
jmpq *%rcx | |
.cfi_endproc | |
.align 2, 0x90 | |
L1_0_set_3 = LBB1_3-LJTI1_0 | |
LJTI1_0: | |
.long L1_0_set_3 | |
.long L1_0_set_3 | |
.long L1_0_set_3 | |
.long L1_0_set_3 | |
.long L1_0_set_3 | |
.subsections_via_symbols |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment