Ran out of registers error in llc
Danna bib
danna1364 at gmail.com
Thu Jun 12 09:29:51 PDT 2014
Hi Quentin,
1- Yes, they look suspicious because I forget to turn off my SWIFT pass.
However, I added my SWIFT pass after ExecutionDependencyFix in
ARMTargetMachcine.cpp file.
....
bool ARMPassConfig::addPreSched2() {
// FIXME: temporarily disabling load / store optimization pass for Thumb1.
if (getOptLevel() != CodeGenOpt::None) {
if (!getARMSubtarget().isThumb1Only()) {
addPass(createARMLoadStoreOptimizationPass());
printAndVerify("After ARM load / store optimizer");
}
if (getARMSubtarget().hasNEON())
addPass(createExecutionDependencyFixPass(&ARM::DPRRegClass));
}
*addPass(createSWIFT());* <- Here is my pass; This pass is responsible
for duplicating instructions (By using reserved registers)
// Expand some pseudo instructions into multiple instructions to allow
// proper scheduling.
addPass(createARMExpandPseudoPass());
....
But, the problem is not because of this SWIFT pass. *Please check the
attached bugpoint.txt*, this is the one which address only to the "ran out
of register during register allocation" error.
2- I got the llc output for several program and cross compiled them for
ARM, and ran them on gem5 simulator. They work perfectly, this error "ran
out of register during register allocation" appears just on some programs
such as JPEG (Mibench) and GCC from SPEC2006.
Thanks,
Danna
On Wed, Jun 11, 2014 at 7:12 PM, Quentin Colombet <qcolombet at apple.com>
wrote:
> Hi Danna,
>
> I haven’t look yet at all your inputs, but the MachineInstr dump for
> bugpoint.txt looks suspicious.
> Let me take an example:
> BB#0: derived from LLVM BB %entry
> Live Ins: %R0 %R1 %R2 %R11 %LR
> %R4<def> = MOVr %R0, pred:14, pred:%noreg, opt:%noreg
> %R7<def> = MOVr %R1, pred:14, pred:%noreg, opt:%noreg
> %R8<def> = MOVr %R2, pred:14, pred:%noreg, opt:%noreg
> %R9<def> = MOVr %R3, pred:14, pred:%noreg, opt:%noreg <— R3 is not
> live in nor defined before being used
> %R10<def> = MOVr %R11, pred:14, pred:%noreg, opt:%noreg
> %R5<def> = SUBrr %R5, %R5, pred:14, pred:%noreg, opt:%noreg <— Same for
> R5
>
> My questions are the following:
> 1. When does your pass run?
> 2. Have you checked that the produced MachineInstr IR is valid (by running
> the verifier after your pass)?
>
> Let us first solve the verifier issues, then we will see if the register
> allocator is at fault.
>
> Thanks,
> -Quentin
>
> On Jun 11, 2014, at 6:31 PM, Danna bib <danna1364 at gmail.com> wrote:
>
> Hi Dear Quentin,
>
> Thank you for your response.
>
> I ran bugpoint, and attach the outputs to this email. Hopefully they help.
>
> My command line is this:
> ~/Desktop/Mibench/consumer/jpeg/jpeg-6a$ llc -reserveRegs=true
> -march=arm -O0 cjpeg.ll -o cjpeg.s
> error: ran out of registers during register allocation
>
> For running bugponit I used this:
> bugpoint cjpeg.ll -llc-safe --safe-tool-args -reserveRegs=true
> -march=arm -O0 | tee bugpoint.txt
>
>
> My goal is duplication of almost all assembly instructions (for applying
> some fault-tolerant method), So, I need to reserve half of registers for
> those duplicated instructions.
>
> regards,
> Danna
>
>
> On Mon, Jun 9, 2014 at 2:43 PM, Quentin Colombet <qcolombet at apple.com>
> wrote:
>
>> Hi Danna,
>>
>> On Jun 2, 2014, at 10:54 AM, Danna bib <danna1364 at gmail.com> wrote:
>>
>> > Hello all,
>> >
>> > I am working with LLVM 3.4. I reserved half of arm registers in order
>> to do some optimization in backend (after register allocation). It works
>> fine with several SPEC2006 benchmarks, but in some of them such as gcc and
>> gobmk, I got the following error.
>> > "LLVM ERROR: ran out of registers during register allocation"
>> > So, my question is how I can solve that problem?
>>
>> Without the input IR, this is hard to tell.
>> Could you try to reduce a test case with bugpoint and we can try to help
>> from here.
>>
>> The question though is why do you need to reserved so many registers?
>>
>> Thanks,
>> -Quentin
>>
>> >
>> > I would appreciate any advise you may have.
>> >
>> > regards,
>> > Danna
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
> <bugpoint.txt><bugpoint-reduced-simplified.bc>
> <bugpoint-reduced-function.bc><bugpoint-reduced-blocks.bc>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140612/de74fc6d/attachment.html>
-------------- next part --------------
Read input file : 'cjpeg.ll'
*** All input ok
Initializing execution environment: Found llc: /home/moslem/LLVM2/build/Release+Asserts/bin/llc
Running the code generator to test for a crash: <llc>
Error running tool:
/home/moslem/LLVM2/build/Release+Asserts/bin/llc -o bugpoint-test-program-c3a688a.bc-a19b7ef.llc.s bugpoint-test-program-c3a688a.bc
llc: /home/moslem/LLVM2/llvm/lib/CodeGen/TargetInstrInfo.cpp:331: virtual llvm::MachineInstr *llvm::TargetInstrInfo::duplicate(llvm::MachineInstr *, llvm::MachineFunction &) const: Assertion `!Orig->isNotDuplicable() && "Instruction cannot be duplicated"' failed.
0 llc 0x000000000113d655 llvm::sys::PrintStackTrace(_IO_FILE*) + 37
1 llc 0x000000000113daa3
2 libpthread.so.0 0x00007f45a8e50340
3 libc.so.6 0x00007f45a7e63f79 gsignal + 57
4 libc.so.6 0x00007f45a7e67388 abort + 328
5 libc.so.6 0x00007f45a7e5ce36
6 libc.so.6 0x00007f45a7e5cee2
7 llc 0x0000000000dfaef1
8 llc 0x0000000000780184 llvm::ARMBaseInstrInfo::duplicate(llvm::MachineInstr*, llvm::MachineFunction&) const + 20
9 llc 0x00000000007adcde
10 llc 0x00000000007ad7bc
11 llc 0x0000000000d2d04c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 124
12 llc 0x00000000010d186a llvm::FPPassManager::runOnFunction(llvm::Function&) + 362
13 llc 0x00000000010d1afb llvm::FPPassManager::runOnModule(llvm::Module&) + 43
14 llc 0x00000000010d2097 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 999
15 llc 0x0000000000551063 main + 6419
16 libc.so.6 0x00007f45a7e4eec5 __libc_start_main + 245
17 llc 0x000000000054f689
Stack dump:
0. Program arguments: /home/moslem/LLVM2/build/Release+Asserts/bin/llc -o bugpoint-test-program-c3a688a.bc-a19b7ef.llc.s bugpoint-test-program-c3a688a.bc
1. Running pass 'Function Pass Manager' on module 'bugpoint-test-program-c3a688a.bc'.
2. Running pass 'Unnamed pass: implement Pass::getPassName()' on function '@forward_DCT_float'
Checking to see if we can delete global inits: <llc>
*** Able to remove all global initializers!
*** Attempting to reduce the number of functions in the testcase
Checking for crash with only these functions: jpeg_CreateCompress jpeg_destroy_compress jpeg_abort_compress jpeg_suppress_tables jpeg_finish_compress jpeg_write_marker jpeg_write_tables jpeg_start_compress jpeg_write_scanlines jpeg_write_raw_data... <391 total>: <llc>Checking for crash with only these functions: start_pass_phuff_decoder decode_mcu_DC_first decode_mcu_AC_first decode_mcu_DC_refine decode_mcu_AC_refine process_restart56 jinit_d_main_controller start_pass_main59 alloc_funny_pointers process_data_context_main... <196 total>: <llc>Checking for crash with only these functions: reset_error_mgr jinit_memory_mgr alloc_small alloc_large alloc_sarray alloc_barray request_virt_sarray request_virt_barray realize_virt_arrays access_virt_sarray... <98 total>: <llc>Checking for crash with only these functions: jpeg_idct_ifast jpeg_idct_float jpeg_idct_islow jpeg_idct_4x4 jpeg_idct_2x2 jpeg_idct_1x1 jinit_upsampler start_pass_upsample sep_upsample noop_upsample... <98 total>: <llc>Checking for crash with only these functions: jinit_1pass_quantizer jinit_merged_upsampler start_pass_merged_upsample merged_2v_upsample h2v2_merged_upsample merged_1v_upsample h2v1_merged_upsample build_ycc_rgb_table93 jpeg_abort jpeg_destroy... <49 total>: <llc>Checking for crash with only these functions: start_pass_phuff make_funny_pointers process_data_simple_main60 process_data_crank_post set_bottom_pointers set_wraparound_pointers jinit_d_coef_controller start_input_pass63 start_output_pass consume_data... <49 total>: <llc>Checking for crash with only these functions: jpeg_idct_ifast jpeg_idct_float jpeg_idct_islow noop_upsample fullsize_upsample h2v1_fancy_upsample h2v1_upsample h2v2_fancy_upsample h2v2_upsample start_pass_phuff... <25 total>: <llc>Checking for crash with only these functions: h2v1_fancy_upsample h2v1_upsample h2v2_fancy_upsample noop_upsample jpeg_idct_islow jpeg_idct_ifast jpeg_idct_float ycck_cmyk_convert grayscale_convert85 ycc_rgb_convert... <13 total>: <llc>Checking for crash with only these functions: h2v1_fancy_upsample h2v1_upsample h2v2_fancy_upsample grayscale_convert85 ycc_rgb_convert build_ycc_rgb_table make_funny_pointers: <llc>Checking for crash with only these functions: jpeg_idct_ifast jpeg_idct_float jpeg_idct_islow null_convert86 ycck_cmyk_convert noop_upsample: <llc>Checking for crash with only these functions: jpeg_idct_ifast null_convert86 ycck_cmyk_convert: <llc>Checking for crash with only these functions: noop_upsample jpeg_idct_float jpeg_idct_islow: <llc>Checking for crash with only these functions: jpeg_idct_float jpeg_idct_islow: <llc>Checking for crash with only these functions: jpeg_idct_islow: <llc>Checking for crash with only these functions: jpeg_idct_float: <llc>Emitted bitcode to 'bugpoint-reduced-function.bc'
Checking for crash with only these blocks: entry for.cond for.body if.then if.end for.inc for.end for.cond109 for.body112 for.inc212... <11 total>: <llc>Checking for crash with only these blocks: for.end for.cond109 for.end213 for.body112 for.body: <llc>Checking for crash with only these blocks: for.inc if.then entry if.end for.cond: <llc>Checking for crash with only these blocks: entry if.end for.cond for.end for.cond109 for.end213 for.body112 for.body: <llc>Checking for crash with only these blocks: for.end213 entry: <llc>Checking for crash with only these blocks: for.body112 for.cond109: <llc>Checking for crash with only these blocks: for.cond109 for.end213 entry: <llc>Checking for crash with only these blocks: for.body112: <llc>Checking for crash with only these blocks: for.body112 for.end213 entry: <llc>Checking for crash with only these blocks: for.body112 for.cond109 entry: <llc>Emitted bitcode to 'bugpoint-reduced-blocks.bc'
Checking for crash with only 291 instructions: <llc>Checking for crash with only 146 instructions: <llc>Checking for crash with only 145 instructions: <llc>Checking for crash with only 73 instructions: <llc>Checking for crash with only 72 instructions: <llc>Checking for crash with only 109 instructions: <llc>Checking for crash with only 55 instructions: <llc>Checking for crash with only 54 instructions: <llc>Checking for crash with only 82 instructions: <llc>Checking for crash with only 27 instructions: <llc>Checking for crash with only 96 instructions: <llc>Checking for crash with only 13 instructions: <llc>Checking for crash with only 103 instructions: <llc>Checking for crash with only 52 instructions: <llc>Checking for crash with only 51 instructions: <llc>Checking for crash with only 26 instructions: <llc>Checking for crash with only 13 instructions: <llc>Checking for crash with only 13 instructions: <llc>Checking for crash with only 20 instructions: <llc>Checking for crash with only 6 instructions: <llc>Checking for crash with only 23 instructions: <llc>Checking for crash with only 3 instructions: <llc>Checking for crash with only 25 instructions: <llc>Checking for crash with only 13 instructions: <llc>Checking for crash with only 12 instructions: <llc>Checking for crash with only 19 instructions: <llc>Checking for crash with only 6 instructions: <llc>Checking for crash with only 22 instructions: <llc>Checking for crash with only 3 instructions: <llc>Checking for crash with only 24 instructions: <llc>Checking for crash with only 1 instruction: <llc>Checking for crash with only 24 instructions: <llc>Checking for crash with only 23 instructions: <llc>Checking for crash with only 22 instructions: <llc>Checking for crash with only 21 instructions: <llc>Checking for crash with only 20 instructions: <llc>Checking for crash with only 19 instructions: <llc>Checking for crash with only 18 instructions: <llc>Checking for crash with only 17 instructions: <llc>Checking for crash with only 16 instructions: <llc>Checking for crash with only 16 instructions: <llc>Checking for crash with only 15 instructions: <llc>Checking for crash with only 15 instructions: <llc>Checking for crash with only 14 instructions: <llc>Checking for crash with only 13 instructions: <llc>Checking for crash with only 12 instructions: <llc>Checking for crash with only 11 instructions: <llc>Checking for crash with only 10 instructions: <llc>Checking for crash with only 9 instructions: <llc>Checking for crash with only 8 instructions: <llc>Checking for crash with only 7 instructions: <llc>Checking for crash with only 6 instructions: <llc>Checking for crash with only 5 instructions: <llc>Checking for crash with only 4 instructions: <llc>
*** Attempting to reduce testcase by deleting instructions: Simplification Level #1
Checking instruction: %cmp110 = icmp slt i32 undef, 8<llc>Checking instruction: %mul127 = fmul float undef, 0x3FF6A09E60000000<llc>Checking instruction: %sub128 = fsub float %mul127, undef<llc>Checking instruction: store float %sub128, float* undef, align 4<llc>
*** Attempting to reduce testcase by deleting instructions: Simplification Level #0
Checking instruction: %cmp110 = icmp slt i32 undef, 8<llc>Checking instruction: %mul127 = fmul float undef, 0x3FF6A09E60000000<llc>Checking instruction: %sub128 = fsub float 0.000000e+00, undef<llc>Checking instruction: store float %sub128, float* undef, align 4<llc>
*** Attempting to perform final cleanups: <llc>Emitted bitcode to 'bugpoint-reduced-simplified.bc'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugpoint-reduced-simplified.bc
Type: application/octet-stream
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140612/de74fc6d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugpoint-reduced-function.bc
Type: application/octet-stream
Size: 38740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140612/de74fc6d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugpoint-reduced-blocks.bc
Type: application/octet-stream
Size: 39836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140612/de74fc6d/attachment-0002.obj>
More information about the llvm-commits
mailing list