[LLVMdev] IndVarSimplify too aggressive ?

Arnaud Allard de Grandmaison Arnaud.AllardDeGrandMaison at dibcom.com
Mon Mar 21 09:21:14 PDT 2011


Thanks Andy & Dan for looking into this.

Tested it on my own backends, and it works great !

Best regards,
--
Arnaud de Grandmaison

-----Original Message-----
From: Andrew Trick [mailto:atrick at apple.com]
Sent: Friday, March 18, 2011 6:11 PM
To: Arnaud Allard de Grandmaison
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] IndVarSimplify too aggressive ?

On Mar 13, 2011, at 2:01 PM, Arnaud Allard de Grandmaison wrote:

> Hi all,
>
> The IndVarSimplify pass seems to be too aggressive when it enlarge the induction variable type ; this can pessimize the generated code when the new induction variable size is not natively supported by the target. This is probably not an issue for x86_64, which supports natively all types, but it is a real one for several embedded targets, with very few native types.
>
> I attached a patch to address this issue; if TargetData is available, the patch attempts to keep the induction variable to a native type when going thru the induction variable users.
>
> Also attached my test-case in C, as well as the resulting assembly output, with and without the patch applied, for arm and x86_32 targets. You will note the loop instructions count can be reduced by 30% in several cases.
>
> The patch could probably be made smarter : I am welcoming all suggestions.

Hi Arnaud,

This should be fixed in r127884. In some cases, your patch could result in multiple IVs for the same recurrence, and LSR was not able to cleanup afterward. Dan Gohman proposed an alternative, which seems to work great. See http://llvm.org/bugs/show_bug.cgi?id=9490.

-Andy




More information about the llvm-dev mailing list