Ran out of registers error in llc

Quentin Colombet qcolombet at apple.com
Thu Jun 12 09:45:32 PDT 2014


Hi Danna,

I am a bit confused because in both outputs of bugpoint, none is showing the Ran out of registers error.

For the first one, the register scavenger failed to find a register, but I’d say it is not unexpected since the input IR seems to be broken.
For the second one, you have an assert in TargetInstrInfo::duplicate.

If you want to use the register scavenger, your MIR must be valid.
You can check that by adding a call to the verifier after your pass (see Passes.cpp for example):
addPass(createMachineVerifierPass(“MyMessage"));

For the assertion, it is hard to guess what is going on, as the backtrace in release mode is not very helpful. Could you produce the same backtrace in debug mode?

Thanks,
-Quentin

On Jun 12, 2014, at 9:29 AM, Danna bib <danna1364 at gmail.com> wrote:

> 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>
> 
> 
> <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/6f9ae2cc/attachment.html>


More information about the llvm-commits mailing list