Provide better -O0 assembly on request

Sergey Dmitrouk sdmitrouk at accesssoftek.com
Fri Apr 24 06:58:13 PDT 2015


Hi,

NOTE: there is an attached patch, but it's to show how it can be achieved not
NOTE: for review, that's why the message is not in llvm-commits.  I'd like to
NOTE: get general opinion on the change.

I've been trying to fix PR13269 (https://llvm.org/bugs/show_bug.cgi?id=13269)
in http://reviews.llvm.org/D9084 as that issue stood in the way of getting
correct debug locations.  With those changes applied it is better in general,
but for -O0 flag debug locations are still a mess as FastISel is used for
generating most of code and it doesn't make use of additional information from
SDNodes.

FastISel resets debug locations on materializing constants (see
http://reviews.llvm.org/rL108302), which is a workaround for issue created by
FastISel by eliminating redundancy for constant emission as it implies
instruction reordering and basically shuffled order of debug locations.

Workaround from r108302 mentioned above fails in the way that some instructions
are assigned debug locations of completely unrelated code lines (see attached
"bad" files right after prologue).

Not resetting debug locations of instructions for constants partially fixes it
although leads to worse debugging experience, but still some auxiliary code like
that for register spilling will be marked with almost random debug locations.

The best (in the sense of "most readable" and "easy to debug") assembly is
produced with disabled local value optimization and intact debug locations (see
"good" files in the attachment).

I'd like to propose adding a way to produce this "debuggable" assembly on
request via additional option in Clang.  It could be enabled on -g3 or maybe we
could introduce -g4, although -g2 and -g3 currently seem to be equivalent to
-g (-g1).  Or some other way if anyone has better idea.

As attached patch for LLVM demonstrates, this is quite easy to achieve.

Best regards,
Sergey
-------------- next part --------------
	.text
	.syntax unified
	.eabi_attribute	67, "2.09"	@ Tag_conformance
	.cpu	cortex-a8
	.eabi_attribute	6, 10	@ Tag_CPU_arch
	.eabi_attribute	7, 65	@ Tag_CPU_arch_profile
	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
	.eabi_attribute	9, 2	@ Tag_THUMB_ISA_use
	.fpu	neon
	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
	.eabi_attribute	28, 1	@ Tag_ABI_VFP_args
	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
	.eabi_attribute	18, 4	@ Tag_ABI_PCS_wchar_t
	.eabi_attribute	26, 2	@ Tag_ABI_enum_size
	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
	.eabi_attribute	68, 1	@ Tag_Virtualization_use
	.file	"test.c"
	.globl	main
	.align	2
	.type	main,%function
main:                                   @ @main
.Lfunc_begin0:
	.file	1 "" "test.c"
	.loc	1 2 0                   @ test.c:2:0
	.fnstart
	.cfi_startproc
@ BB#0:                                 @ %entry
	.loc	1 3 9 prologue_end      @ test.c:3:9
	.pad	#8
	sub	sp, sp, #8
.Ltmp0:
	.cfi_def_cfa_offset 8
	movw	r0, #0
	str	r0, [sp, #4]
	str	r0, [sp]
	.loc	1 5 9                   @ test.c:5:9
.Ltmp1:
	ldr	r0, [sp]
.Ltmp2:
	.loc	1 5 9 is_stmt 0         @ test.c:5:9
	cmp	r0, #0
	ble	.LBB0_2
@ BB#1:                                 @ %if.then
	.loc	1 6 17 is_stmt 1        @ test.c:6:17
.Ltmp3:
	ldr	r0, [sp]
	.loc	1 6 9 is_stmt 0         @ test.c:6:9
	str	r0, [sp, #4]
	b	.LBB0_3
.Ltmp4:
.LBB0_2:                                @ %if.end
	.loc	1 10 5 is_stmt 1        @ test.c:10:5
	mvn	r0, #0
	.loc	1 8 7                   @ test.c:8:7
	str	r0, [sp]
	.loc	1 10 5                  @ test.c:10:5
	str	r0, [sp, #4]
.LBB0_3:                                @ %return
	.loc	1 11 1                  @ test.c:11:1
	ldr	r0, [sp, #4]
	add	sp, sp, #8
	bx	lr
.Ltmp5:
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.cantunwind
	.fnend

	.section	.debug_str,"MS",%progbits,1
.Linfo_string0:
	.asciz	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
.Linfo_string1:
	.asciz	"test.c"
.Linfo_string2:
	.asciz	"/home/xaizek/repos/clang-llvm/release"
.Linfo_string3:
	.asciz	"main"
.Linfo_string4:
	.asciz	"int"
.Linfo_string5:
	.asciz	"x"
	.section	.debug_loc,"",%progbits
	.section	.debug_abbrev,"",%progbits
.Lsection_abbrev:
	.byte	1                       @ Abbreviation Code
	.byte	17                      @ DW_TAG_compile_unit
	.byte	1                       @ DW_CHILDREN_yes
	.byte	37                      @ DW_AT_producer
	.byte	14                      @ DW_FORM_strp
	.byte	19                      @ DW_AT_language
	.byte	5                       @ DW_FORM_data2
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	16                      @ DW_AT_stmt_list
	.byte	23                      @ DW_FORM_sec_offset
	.byte	27                      @ DW_AT_comp_dir
	.byte	14                      @ DW_FORM_strp
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	2                       @ Abbreviation Code
	.byte	46                      @ DW_TAG_subprogram
	.byte	1                       @ DW_CHILDREN_yes
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	64                      @ DW_AT_frame_base
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	63                      @ DW_AT_external
	.byte	25                      @ DW_FORM_flag_present
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	3                       @ Abbreviation Code
	.byte	52                      @ DW_TAG_variable
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	4                       @ Abbreviation Code
	.byte	36                      @ DW_TAG_base_type
	.byte	0                       @ DW_CHILDREN_no
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	62                      @ DW_AT_encoding
	.byte	11                      @ DW_FORM_data1
	.byte	11                      @ DW_AT_byte_size
	.byte	11                      @ DW_FORM_data1
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	0                       @ EOM(3)
	.section	.debug_info,"",%progbits
.Lsection_info:
.Lcu_begin0:
	.long	78                      @ Length of Unit
	.short	4                       @ DWARF version number
	.long	.Lsection_abbrev        @ Offset Into Abbrev. Section
	.byte	4                       @ Address Size (in bytes)
	.byte	1                       @ Abbrev [1] 0xb:0x47 DW_TAG_compile_unit
	.long	.Linfo_string0          @ DW_AT_producer
	.short	12                      @ DW_AT_language
	.long	.Linfo_string1          @ DW_AT_name
	.long	.Lline_table_start0     @ DW_AT_stmt_list
	.long	.Linfo_string2          @ DW_AT_comp_dir
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	2                       @ Abbrev [2] 0x26:0x24 DW_TAG_subprogram
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	1                       @ DW_AT_frame_base
	.byte	93
	.long	.Linfo_string3          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
	.long	74                      @ DW_AT_type
                                        @ DW_AT_external
	.byte	3                       @ Abbrev [3] 0x3b:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	0
	.long	.Linfo_string5          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	3                       @ DW_AT_decl_line
	.long	74                      @ DW_AT_type
	.byte	0                       @ End Of Children Mark
	.byte	4                       @ Abbrev [4] 0x4a:0x7 DW_TAG_base_type
	.long	.Linfo_string4          @ DW_AT_name
	.byte	5                       @ DW_AT_encoding
	.byte	4                       @ DW_AT_byte_size
	.byte	0                       @ End Of Children Mark
	.section	.debug_ranges,"",%progbits
.Ldebug_range:
	.section	.debug_pubnames,"",%progbits
	.long	.LpubNames_end0-.LpubNames_begin0 @ Length of Public Names Info
.LpubNames_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	82                      @ Compilation Unit Length
	.long	38                      @ DIE offset
	.asciz	"main"                  @ External Name
	.long	0                       @ End Mark
.LpubNames_end0:
	.section	.debug_pubtypes,"",%progbits
	.long	.LpubTypes_end0-.LpubTypes_begin0 @ Length of Public Types Info
.LpubTypes_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	82                      @ Compilation Unit Length
	.long	74                      @ DIE offset
	.asciz	"int"                   @ External Name
	.long	0                       @ End Mark
.LpubTypes_end0:
	.cfi_sections .debug_frame

	.ident	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
	.section	".note.GNU-stack","",%progbits
	.section	.debug_line,"",%progbits
.Lline_table_start0:
-------------- next part --------------
	.text
	.syntax unified
	.eabi_attribute	67, "2.09"	@ Tag_conformance
	.cpu	cortex-a8
	.eabi_attribute	6, 10	@ Tag_CPU_arch
	.eabi_attribute	7, 65	@ Tag_CPU_arch_profile
	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
	.eabi_attribute	9, 2	@ Tag_THUMB_ISA_use
	.fpu	neon
	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
	.eabi_attribute	28, 1	@ Tag_ABI_VFP_args
	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
	.eabi_attribute	18, 4	@ Tag_ABI_PCS_wchar_t
	.eabi_attribute	26, 2	@ Tag_ABI_enum_size
	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
	.eabi_attribute	68, 1	@ Tag_Virtualization_use
	.file	"test.c"
	.globl	main
	.align	2
	.type	main,%function
main:                                   @ @main
.Lfunc_begin0:
	.file	1 "" "test.c"
	.loc	1 2 0                   @ test.c:2:0
	.fnstart
	.cfi_startproc
@ BB#0:                                 @ %entry
	.loc	1 5 9 prologue_end      @ test.c:5:9
	.pad	#16
	sub	sp, sp, #16
.Ltmp0:
	.cfi_def_cfa_offset 16
	mvn	r1, #0
	.loc	1 4 9                   @ test.c:4:9
	mvn	r2, #3
	movw	r3, #0
	str	r3, [sp, #12]
	str	r0, [sp, #8]
	.loc	1 3 7                   @ test.c:3:7
	str	r1, [sp, #8]
	.loc	1 4 9                   @ test.c:4:9
	str	r2, [sp, #4]
	.loc	1 5 9                   @ test.c:5:9
	str	r1, [sp]
	.loc	1 6 9                   @ test.c:6:9
.Ltmp1:
	ldr	r0, [sp, #8]
.Ltmp2:
	.loc	1 6 9 is_stmt 0         @ test.c:6:9
	cmp	r0, #0
	bne	.LBB0_2
@ BB#1:                                 @ %if.then
	.loc	1 7 9 is_stmt 1         @ test.c:7:9
.Ltmp3:
	mvn	r0, #3
	str	r0, [sp, #12]
	b	.LBB0_9
.Ltmp4:
.LBB0_2:                                @ %if.end
	.loc	1 10 7                  @ test.c:10:7
	mvn	r0, #1
	str	r0, [sp, #8]
	.loc	1 11 9                  @ test.c:11:9
.Ltmp5:
	ldr	r0, [sp, #8]
.Ltmp6:
	.loc	1 11 9 is_stmt 0        @ test.c:11:9
	cmp	r0, #0
	bne	.LBB0_4
@ BB#3:                                 @ %if.then2
	.loc	1 12 9 is_stmt 1        @ test.c:12:9
.Ltmp7:
	mvn	r0, #2
	str	r0, [sp, #12]
	b	.LBB0_9
.Ltmp8:
.LBB0_4:                                @ %if.end3
	.loc	1 15 7                  @ test.c:15:7
	mvn	r0, #2
	str	r0, [sp, #8]
	.loc	1 16 9                  @ test.c:16:9
.Ltmp9:
	ldr	r0, [sp, #8]
.Ltmp10:
	.loc	1 16 9 is_stmt 0        @ test.c:16:9
	cmp	r0, #0
	bne	.LBB0_6
@ BB#5:                                 @ %if.then5
	.loc	1 17 9 is_stmt 1        @ test.c:17:9
.Ltmp11:
	mvn	r0, #1
	str	r0, [sp, #12]
	b	.LBB0_9
.Ltmp12:
.LBB0_6:                                @ %if.end6
	.loc	1 20 7                  @ test.c:20:7
	mvn	r0, #3
	str	r0, [sp, #8]
	.loc	1 21 9                  @ test.c:21:9
.Ltmp13:
	ldr	r0, [sp, #8]
.Ltmp14:
	.loc	1 21 9 is_stmt 0        @ test.c:21:9
	cmp	r0, #0
	bne	.LBB0_8
@ BB#7:                                 @ %if.then8
	.loc	1 22 9 is_stmt 1        @ test.c:22:9
.Ltmp15:
	mvn	r0, #0
	str	r0, [sp, #12]
	b	.LBB0_9
.Ltmp16:
.LBB0_8:                                @ %if.end9
	.loc	1 25 5                  @ test.c:25:5
	movw	r0, #0
	str	r0, [sp, #12]
.LBB0_9:                                @ %return
	.loc	1 26 1                  @ test.c:26:1
	ldr	r0, [sp, #12]
	add	sp, sp, #16
	bx	lr
.Ltmp17:
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.cantunwind
	.fnend

	.section	.debug_str,"MS",%progbits,1
.Linfo_string0:
	.asciz	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
.Linfo_string1:
	.asciz	"test.c"
.Linfo_string2:
	.asciz	"/home/xaizek/repos/clang-llvm/release"
.Linfo_string3:
	.asciz	"main"
.Linfo_string4:
	.asciz	"int"
.Linfo_string5:
	.asciz	"x"
.Linfo_string6:
	.asciz	"y"
.Linfo_string7:
	.asciz	"z"
	.section	.debug_loc,"",%progbits
	.section	.debug_abbrev,"",%progbits
.Lsection_abbrev:
	.byte	1                       @ Abbreviation Code
	.byte	17                      @ DW_TAG_compile_unit
	.byte	1                       @ DW_CHILDREN_yes
	.byte	37                      @ DW_AT_producer
	.byte	14                      @ DW_FORM_strp
	.byte	19                      @ DW_AT_language
	.byte	5                       @ DW_FORM_data2
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	16                      @ DW_AT_stmt_list
	.byte	23                      @ DW_FORM_sec_offset
	.byte	27                      @ DW_AT_comp_dir
	.byte	14                      @ DW_FORM_strp
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	2                       @ Abbreviation Code
	.byte	46                      @ DW_TAG_subprogram
	.byte	1                       @ DW_CHILDREN_yes
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	64                      @ DW_AT_frame_base
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	39                      @ DW_AT_prototyped
	.byte	25                      @ DW_FORM_flag_present
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	63                      @ DW_AT_external
	.byte	25                      @ DW_FORM_flag_present
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	3                       @ Abbreviation Code
	.byte	5                       @ DW_TAG_formal_parameter
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	4                       @ Abbreviation Code
	.byte	52                      @ DW_TAG_variable
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	5                       @ Abbreviation Code
	.byte	36                      @ DW_TAG_base_type
	.byte	0                       @ DW_CHILDREN_no
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	62                      @ DW_AT_encoding
	.byte	11                      @ DW_FORM_data1
	.byte	11                      @ DW_AT_byte_size
	.byte	11                      @ DW_FORM_data1
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	0                       @ EOM(3)
	.section	.debug_info,"",%progbits
.Lsection_info:
.Lcu_begin0:
	.long	106                     @ Length of Unit
	.short	4                       @ DWARF version number
	.long	.Lsection_abbrev        @ Offset Into Abbrev. Section
	.byte	4                       @ Address Size (in bytes)
	.byte	1                       @ Abbrev [1] 0xb:0x63 DW_TAG_compile_unit
	.long	.Linfo_string0          @ DW_AT_producer
	.short	12                      @ DW_AT_language
	.long	.Linfo_string1          @ DW_AT_name
	.long	.Lline_table_start0     @ DW_AT_stmt_list
	.long	.Linfo_string2          @ DW_AT_comp_dir
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	2                       @ Abbrev [2] 0x26:0x40 DW_TAG_subprogram
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	1                       @ DW_AT_frame_base
	.byte	93
	.long	.Linfo_string3          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
                                        @ DW_AT_prototyped
	.long	102                     @ DW_AT_type
                                        @ DW_AT_external
	.byte	3                       @ Abbrev [3] 0x3b:0xe DW_TAG_formal_parameter
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	8
	.long	.Linfo_string5          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	4                       @ Abbrev [4] 0x49:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	4
	.long	.Linfo_string6          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	4                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	4                       @ Abbrev [4] 0x57:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	0
	.long	.Linfo_string7          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	5                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	0                       @ End Of Children Mark
	.byte	5                       @ Abbrev [5] 0x66:0x7 DW_TAG_base_type
	.long	.Linfo_string4          @ DW_AT_name
	.byte	5                       @ DW_AT_encoding
	.byte	4                       @ DW_AT_byte_size
	.byte	0                       @ End Of Children Mark
	.section	.debug_ranges,"",%progbits
.Ldebug_range:
	.section	.debug_pubnames,"",%progbits
	.long	.LpubNames_end0-.LpubNames_begin0 @ Length of Public Names Info
.LpubNames_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	110                     @ Compilation Unit Length
	.long	38                      @ DIE offset
	.asciz	"main"                  @ External Name
	.long	0                       @ End Mark
.LpubNames_end0:
	.section	.debug_pubtypes,"",%progbits
	.long	.LpubTypes_end0-.LpubTypes_begin0 @ Length of Public Types Info
.LpubTypes_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	110                     @ Compilation Unit Length
	.long	102                     @ DIE offset
	.asciz	"int"                   @ External Name
	.long	0                       @ End Mark
.LpubTypes_end0:
	.cfi_sections .debug_frame

	.ident	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
	.section	".note.GNU-stack","",%progbits
	.section	.debug_line,"",%progbits
.Lline_table_start0:
-------------- next part --------------
	.text
	.syntax unified
	.eabi_attribute	67, "2.09"	@ Tag_conformance
	.cpu	cortex-a8
	.eabi_attribute	6, 10	@ Tag_CPU_arch
	.eabi_attribute	7, 65	@ Tag_CPU_arch_profile
	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
	.eabi_attribute	9, 2	@ Tag_THUMB_ISA_use
	.fpu	neon
	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
	.eabi_attribute	28, 1	@ Tag_ABI_VFP_args
	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
	.eabi_attribute	18, 4	@ Tag_ABI_PCS_wchar_t
	.eabi_attribute	26, 2	@ Tag_ABI_enum_size
	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
	.eabi_attribute	68, 1	@ Tag_Virtualization_use
	.file	"test.c"
	.globl	main
	.align	2
	.type	main,%function
main:                                   @ @main
.Lfunc_begin0:
	.file	1 "" "test.c"
	.loc	1 2 0                   @ test.c:2:0
	.fnstart
	.cfi_startproc
@ BB#0:                                 @ %entry
	.pad	#8
	sub	sp, sp, #8
.Ltmp0:
	.cfi_def_cfa_offset 8
	movw	r0, #0
	movw	r1, #0
	str	r1, [sp, #4]
	.loc	1 3 9 prologue_end      @ test.c:3:9
.Ltmp1:
	str	r0, [sp]
	.loc	1 5 9                   @ test.c:5:9
.Ltmp2:
	ldr	r0, [sp]
.Ltmp3:
	.loc	1 5 9 is_stmt 0         @ test.c:5:9
	cmp	r0, #0
	ble	.LBB0_2
@ BB#1:                                 @ %if.then
	.loc	1 6 17 is_stmt 1        @ test.c:6:17
.Ltmp4:
	ldr	r0, [sp]
	.loc	1 6 9 is_stmt 0         @ test.c:6:9
	str	r0, [sp, #4]
	b	.LBB0_3
.Ltmp5:
.LBB0_2:                                @ %if.end
	mvn	r0, #0
	mvn	r1, #0
	.loc	1 8 7 is_stmt 1         @ test.c:8:7
	str	r1, [sp]
	.loc	1 10 5                  @ test.c:10:5
	str	r0, [sp, #4]
.LBB0_3:                                @ %return
	.loc	1 11 1                  @ test.c:11:1
	ldr	r0, [sp, #4]
	add	sp, sp, #8
	bx	lr
.Ltmp6:
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.cantunwind
	.fnend

	.section	.debug_str,"MS",%progbits,1
.Linfo_string0:
	.asciz	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
.Linfo_string1:
	.asciz	"test.c"
.Linfo_string2:
	.asciz	"/home/xaizek/repos/clang-llvm/release"
.Linfo_string3:
	.asciz	"main"
.Linfo_string4:
	.asciz	"int"
.Linfo_string5:
	.asciz	"x"
	.section	.debug_loc,"",%progbits
	.section	.debug_abbrev,"",%progbits
.Lsection_abbrev:
	.byte	1                       @ Abbreviation Code
	.byte	17                      @ DW_TAG_compile_unit
	.byte	1                       @ DW_CHILDREN_yes
	.byte	37                      @ DW_AT_producer
	.byte	14                      @ DW_FORM_strp
	.byte	19                      @ DW_AT_language
	.byte	5                       @ DW_FORM_data2
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	16                      @ DW_AT_stmt_list
	.byte	23                      @ DW_FORM_sec_offset
	.byte	27                      @ DW_AT_comp_dir
	.byte	14                      @ DW_FORM_strp
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	2                       @ Abbreviation Code
	.byte	46                      @ DW_TAG_subprogram
	.byte	1                       @ DW_CHILDREN_yes
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	64                      @ DW_AT_frame_base
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	63                      @ DW_AT_external
	.byte	25                      @ DW_FORM_flag_present
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	3                       @ Abbreviation Code
	.byte	52                      @ DW_TAG_variable
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	4                       @ Abbreviation Code
	.byte	36                      @ DW_TAG_base_type
	.byte	0                       @ DW_CHILDREN_no
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	62                      @ DW_AT_encoding
	.byte	11                      @ DW_FORM_data1
	.byte	11                      @ DW_AT_byte_size
	.byte	11                      @ DW_FORM_data1
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	0                       @ EOM(3)
	.section	.debug_info,"",%progbits
.Lsection_info:
.Lcu_begin0:
	.long	78                      @ Length of Unit
	.short	4                       @ DWARF version number
	.long	.Lsection_abbrev        @ Offset Into Abbrev. Section
	.byte	4                       @ Address Size (in bytes)
	.byte	1                       @ Abbrev [1] 0xb:0x47 DW_TAG_compile_unit
	.long	.Linfo_string0          @ DW_AT_producer
	.short	12                      @ DW_AT_language
	.long	.Linfo_string1          @ DW_AT_name
	.long	.Lline_table_start0     @ DW_AT_stmt_list
	.long	.Linfo_string2          @ DW_AT_comp_dir
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	2                       @ Abbrev [2] 0x26:0x24 DW_TAG_subprogram
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	1                       @ DW_AT_frame_base
	.byte	93
	.long	.Linfo_string3          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
	.long	74                      @ DW_AT_type
                                        @ DW_AT_external
	.byte	3                       @ Abbrev [3] 0x3b:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	0
	.long	.Linfo_string5          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	3                       @ DW_AT_decl_line
	.long	74                      @ DW_AT_type
	.byte	0                       @ End Of Children Mark
	.byte	4                       @ Abbrev [4] 0x4a:0x7 DW_TAG_base_type
	.long	.Linfo_string4          @ DW_AT_name
	.byte	5                       @ DW_AT_encoding
	.byte	4                       @ DW_AT_byte_size
	.byte	0                       @ End Of Children Mark
	.section	.debug_ranges,"",%progbits
.Ldebug_range:
	.section	.debug_pubnames,"",%progbits
	.long	.LpubNames_end0-.LpubNames_begin0 @ Length of Public Names Info
.LpubNames_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	82                      @ Compilation Unit Length
	.long	38                      @ DIE offset
	.asciz	"main"                  @ External Name
	.long	0                       @ End Mark
.LpubNames_end0:
	.section	.debug_pubtypes,"",%progbits
	.long	.LpubTypes_end0-.LpubTypes_begin0 @ Length of Public Types Info
.LpubTypes_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	82                      @ Compilation Unit Length
	.long	74                      @ DIE offset
	.asciz	"int"                   @ External Name
	.long	0                       @ End Mark
.LpubTypes_end0:
	.cfi_sections .debug_frame

	.ident	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
	.section	".note.GNU-stack","",%progbits
	.section	.debug_line,"",%progbits
.Lline_table_start0:
-------------- next part --------------
	.text
	.syntax unified
	.eabi_attribute	67, "2.09"	@ Tag_conformance
	.cpu	cortex-a8
	.eabi_attribute	6, 10	@ Tag_CPU_arch
	.eabi_attribute	7, 65	@ Tag_CPU_arch_profile
	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
	.eabi_attribute	9, 2	@ Tag_THUMB_ISA_use
	.fpu	neon
	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
	.eabi_attribute	28, 1	@ Tag_ABI_VFP_args
	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
	.eabi_attribute	18, 4	@ Tag_ABI_PCS_wchar_t
	.eabi_attribute	26, 2	@ Tag_ABI_enum_size
	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
	.eabi_attribute	68, 1	@ Tag_Virtualization_use
	.file	"test.c"
	.globl	main
	.align	2
	.type	main,%function
main:                                   @ @main
.Lfunc_begin0:
	.file	1 "" "test.c"
	.loc	1 2 0                   @ test.c:2:0
	.fnstart
	.cfi_startproc
@ BB#0:                                 @ %entry
	.save	{r11, lr}
	push	{r11, lr}
.Ltmp0:
	.cfi_def_cfa_offset 8
.Ltmp1:
	.cfi_offset lr, -4
.Ltmp2:
	.cfi_offset r11, -8
	.pad	#20
	sub	sp, sp, #20
.Ltmp3:
	.cfi_def_cfa_offset 28
	mov	r1, r0
	mvn	r2, #0
	mvn	r3, #3
	mvn	r12, #0
	movw	lr, #0
	str	lr, [sp, #16]
	str	r0, [sp, #12]
	.loc	1 3 7 prologue_end      @ test.c:3:7
.Ltmp4:
	str	r12, [sp, #12]
	.loc	1 4 9                   @ test.c:4:9
	str	r3, [sp, #8]
	.loc	1 5 9                   @ test.c:5:9
	str	r2, [sp, #4]
	.loc	1 6 9                   @ test.c:6:9
.Ltmp5:
	ldr	r0, [sp, #12]
.Ltmp6:
	.loc	1 6 9 is_stmt 0         @ test.c:6:9
	cmp	r0, #0
	str	r1, [sp]                @ 4-byte Spill
	bne	.LBB0_2
@ BB#1:                                 @ %if.then
	mvn	r0, #3
	.loc	1 7 9 is_stmt 1         @ test.c:7:9
.Ltmp7:
	str	r0, [sp, #16]
	b	.LBB0_9
.Ltmp8:
.LBB0_2:                                @ %if.end
	mvn	r0, #1
	.loc	1 10 7                  @ test.c:10:7
	str	r0, [sp, #12]
	.loc	1 11 9                  @ test.c:11:9
.Ltmp9:
	ldr	r0, [sp, #12]
.Ltmp10:
	.loc	1 11 9 is_stmt 0        @ test.c:11:9
	cmp	r0, #0
	bne	.LBB0_4
@ BB#3:                                 @ %if.then2
	mvn	r0, #2
	.loc	1 12 9 is_stmt 1        @ test.c:12:9
.Ltmp11:
	str	r0, [sp, #16]
	b	.LBB0_9
.Ltmp12:
.LBB0_4:                                @ %if.end3
	mvn	r0, #2
	.loc	1 15 7                  @ test.c:15:7
	str	r0, [sp, #12]
	.loc	1 16 9                  @ test.c:16:9
.Ltmp13:
	ldr	r0, [sp, #12]
.Ltmp14:
	.loc	1 16 9 is_stmt 0        @ test.c:16:9
	cmp	r0, #0
	bne	.LBB0_6
@ BB#5:                                 @ %if.then5
	mvn	r0, #1
	.loc	1 17 9 is_stmt 1        @ test.c:17:9
.Ltmp15:
	str	r0, [sp, #16]
	b	.LBB0_9
.Ltmp16:
.LBB0_6:                                @ %if.end6
	mvn	r0, #3
	.loc	1 20 7                  @ test.c:20:7
	str	r0, [sp, #12]
	.loc	1 21 9                  @ test.c:21:9
.Ltmp17:
	ldr	r0, [sp, #12]
.Ltmp18:
	.loc	1 21 9 is_stmt 0        @ test.c:21:9
	cmp	r0, #0
	bne	.LBB0_8
@ BB#7:                                 @ %if.then8
	mvn	r0, #0
	.loc	1 22 9 is_stmt 1        @ test.c:22:9
.Ltmp19:
	str	r0, [sp, #16]
	b	.LBB0_9
.Ltmp20:
.LBB0_8:                                @ %if.end9
	movw	r0, #0
	.loc	1 25 5                  @ test.c:25:5
	str	r0, [sp, #16]
.LBB0_9:                                @ %return
	.loc	1 26 1                  @ test.c:26:1
	ldr	r0, [sp, #16]
	add	sp, sp, #20
	pop	{r11, pc}
.Ltmp21:
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
	.cantunwind
	.fnend

	.section	.debug_str,"MS",%progbits,1
.Linfo_string0:
	.asciz	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
.Linfo_string1:
	.asciz	"test.c"
.Linfo_string2:
	.asciz	"/home/xaizek/repos/clang-llvm/release"
.Linfo_string3:
	.asciz	"main"
.Linfo_string4:
	.asciz	"int"
.Linfo_string5:
	.asciz	"x"
.Linfo_string6:
	.asciz	"y"
.Linfo_string7:
	.asciz	"z"
	.section	.debug_loc,"",%progbits
	.section	.debug_abbrev,"",%progbits
.Lsection_abbrev:
	.byte	1                       @ Abbreviation Code
	.byte	17                      @ DW_TAG_compile_unit
	.byte	1                       @ DW_CHILDREN_yes
	.byte	37                      @ DW_AT_producer
	.byte	14                      @ DW_FORM_strp
	.byte	19                      @ DW_AT_language
	.byte	5                       @ DW_FORM_data2
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	16                      @ DW_AT_stmt_list
	.byte	23                      @ DW_FORM_sec_offset
	.byte	27                      @ DW_AT_comp_dir
	.byte	14                      @ DW_FORM_strp
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	2                       @ Abbreviation Code
	.byte	46                      @ DW_TAG_subprogram
	.byte	1                       @ DW_CHILDREN_yes
	.byte	17                      @ DW_AT_low_pc
	.byte	1                       @ DW_FORM_addr
	.byte	18                      @ DW_AT_high_pc
	.byte	6                       @ DW_FORM_data4
	.byte	64                      @ DW_AT_frame_base
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	39                      @ DW_AT_prototyped
	.byte	25                      @ DW_FORM_flag_present
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	63                      @ DW_AT_external
	.byte	25                      @ DW_FORM_flag_present
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	3                       @ Abbreviation Code
	.byte	5                       @ DW_TAG_formal_parameter
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	4                       @ Abbreviation Code
	.byte	52                      @ DW_TAG_variable
	.byte	0                       @ DW_CHILDREN_no
	.byte	2                       @ DW_AT_location
	.byte	24                      @ DW_FORM_exprloc
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	58                      @ DW_AT_decl_file
	.byte	11                      @ DW_FORM_data1
	.byte	59                      @ DW_AT_decl_line
	.byte	11                      @ DW_FORM_data1
	.byte	73                      @ DW_AT_type
	.byte	19                      @ DW_FORM_ref4
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	5                       @ Abbreviation Code
	.byte	36                      @ DW_TAG_base_type
	.byte	0                       @ DW_CHILDREN_no
	.byte	3                       @ DW_AT_name
	.byte	14                      @ DW_FORM_strp
	.byte	62                      @ DW_AT_encoding
	.byte	11                      @ DW_FORM_data1
	.byte	11                      @ DW_AT_byte_size
	.byte	11                      @ DW_FORM_data1
	.byte	0                       @ EOM(1)
	.byte	0                       @ EOM(2)
	.byte	0                       @ EOM(3)
	.section	.debug_info,"",%progbits
.Lsection_info:
.Lcu_begin0:
	.long	106                     @ Length of Unit
	.short	4                       @ DWARF version number
	.long	.Lsection_abbrev        @ Offset Into Abbrev. Section
	.byte	4                       @ Address Size (in bytes)
	.byte	1                       @ Abbrev [1] 0xb:0x63 DW_TAG_compile_unit
	.long	.Linfo_string0          @ DW_AT_producer
	.short	12                      @ DW_AT_language
	.long	.Linfo_string1          @ DW_AT_name
	.long	.Lline_table_start0     @ DW_AT_stmt_list
	.long	.Linfo_string2          @ DW_AT_comp_dir
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	2                       @ Abbrev [2] 0x26:0x40 DW_TAG_subprogram
	.long	.Lfunc_begin0           @ DW_AT_low_pc
	.long	.Lfunc_end0-.Lfunc_begin0 @ DW_AT_high_pc
	.byte	1                       @ DW_AT_frame_base
	.byte	93
	.long	.Linfo_string3          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
                                        @ DW_AT_prototyped
	.long	102                     @ DW_AT_type
                                        @ DW_AT_external
	.byte	3                       @ Abbrev [3] 0x3b:0xe DW_TAG_formal_parameter
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	12
	.long	.Linfo_string5          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	1                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	4                       @ Abbrev [4] 0x49:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	8
	.long	.Linfo_string6          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	4                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	4                       @ Abbrev [4] 0x57:0xe DW_TAG_variable
	.byte	2                       @ DW_AT_location
	.byte	145
	.byte	4
	.long	.Linfo_string7          @ DW_AT_name
	.byte	1                       @ DW_AT_decl_file
	.byte	5                       @ DW_AT_decl_line
	.long	102                     @ DW_AT_type
	.byte	0                       @ End Of Children Mark
	.byte	5                       @ Abbrev [5] 0x66:0x7 DW_TAG_base_type
	.long	.Linfo_string4          @ DW_AT_name
	.byte	5                       @ DW_AT_encoding
	.byte	4                       @ DW_AT_byte_size
	.byte	0                       @ End Of Children Mark
	.section	.debug_ranges,"",%progbits
.Ldebug_range:
	.section	.debug_pubnames,"",%progbits
	.long	.LpubNames_end0-.LpubNames_begin0 @ Length of Public Names Info
.LpubNames_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	110                     @ Compilation Unit Length
	.long	38                      @ DIE offset
	.asciz	"main"                  @ External Name
	.long	0                       @ End Mark
.LpubNames_end0:
	.section	.debug_pubtypes,"",%progbits
	.long	.LpubTypes_end0-.LpubTypes_begin0 @ Length of Public Types Info
.LpubTypes_begin0:
	.short	2                       @ DWARF Version
	.long	.Lcu_begin0             @ Offset of Compilation Unit Info
	.long	110                     @ Compilation Unit Length
	.long	102                     @ DIE offset
	.asciz	"int"                   @ External Name
	.long	0                       @ End Mark
.LpubTypes_end0:
	.cfi_sections .debug_frame

	.ident	"clang version 3.7.0 (http://llvm.org/git/clang.git 91e509234ee370ec58a1cb3fa7e6b1ad5a74c891) (http://llvm.org/git/llvm.git 2fbc652200639317cd35c1d924a606e711b0eec7)"
	.section	".note.GNU-stack","",%progbits
	.section	.debug_line,"",%progbits
.Lline_table_start0:
-------------- next part --------------
 include/llvm/Target/TargetOptions.h   |  6 +++++-
 lib/CodeGen/SelectionDAG/FastISel.cpp | 18 +++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h
index 0fe530d..96d8cd2 100644
--- a/include/llvm/Target/TargetOptions.h
+++ b/include/llvm/Target/TargetOptions.h
@@ -71,7 +71,8 @@ namespace llvm {
           UseInitArray(false), DisableIntegratedAS(false),
           CompressDebugSections(false), FunctionSections(false),
           DataSections(false), UniqueSectionNames(true), TrapUnreachable(false),
-          TrapFuncName(), FloatABIType(FloatABI::Default),
+          NoConstantElim(false), TrapFuncName(),
+          FloatABIType(FloatABI::Default),
           AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single),
           ThreadModel(ThreadModel::POSIX) {}
 
@@ -185,6 +186,9 @@ namespace llvm {
     /// Emit target-specific trap instruction for 'unreachable' IR instructions.
     unsigned TrapUnreachable : 1;
 
+    /// Do not eliminate constants within basic blocks.
+    unsigned NoConstantElim : 1;
+
     /// getTrapFunctionName - If this returns a non-empty string, this means
     /// isel should lower Intrinsic::trap to a call to the specified function
     /// name instead of an ISD::TRAP node.
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index 5ffb826..ba1d1e6 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -110,7 +110,7 @@ bool FastISel::lowerArguments() {
     // parameter.
     return false;
 
-  if (!fastLowerArguments())
+  if (!fastLowerArguments() || !localValueMapIsEnabled())
     return false;
 
   // Enter arguments into ValueMap for uses in non-entry BBs.
@@ -131,6 +131,10 @@ void FastISel::flushLocalValueMap() {
   SavedInsertPt = FuncInfo.InsertPt;
 }
 
+bool FastISel::localValueMapIsEnabled() const {
+  return !TM.Options.NoConstantElim;
+}
+
 bool FastISel::hasTrivialKill(const Value *V) {
   // Don't consider constants or arguments to have trivial kills.
   const Instruction *I = dyn_cast<Instruction>(V);
@@ -274,7 +278,7 @@ unsigned FastISel::materializeRegForValue(const Value *V, MVT VT) {
 
   // Don't cache constant materializations in the general ValueMap.
   // To do so would require tracking what uses they dominate.
-  if (Reg) {
+  if (Reg && localValueMapIsEnabled()) {
     LocalValueMap[V] = Reg;
     LastLocalValue = MRI.getVRegDef(Reg);
   }
@@ -294,7 +298,9 @@ unsigned FastISel::lookUpRegForValue(const Value *V) {
 
 void FastISel::updateValueMap(const Value *I, unsigned Reg, unsigned NumRegs) {
   if (!isa<Instruction>(I)) {
-    LocalValueMap[I] = Reg;
+    if (localValueMapIsEnabled()) {
+      LocalValueMap[I] = Reg;
+    }
     return;
   }
 
@@ -361,6 +367,9 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
 }
 
 FastISel::SavePoint FastISel::enterLocalValueArea() {
+  if (localValueMapIsEnabled())
+    return SavePoint();
+
   MachineBasicBlock::iterator OldInsertPt = FuncInfo.InsertPt;
   DebugLoc OldDL = DbgLoc;
   recomputeInsertPt();
@@ -370,6 +379,9 @@ FastISel::SavePoint FastISel::enterLocalValueArea() {
 }
 
 void FastISel::leaveLocalValueArea(SavePoint OldInsertPt) {
+  if (localValueMapIsEnabled())
+    return;
+
   if (FuncInfo.InsertPt != FuncInfo.MBB->begin())
     LastLocalValue = std::prev(FuncInfo.InsertPt);
 


More information about the llvm-commits mailing list