[llvm-commits] [PATCH] - Instcombine vector code optimizations
clattner at apple.com
Sat Apr 9 00:43:28 CDT 2011
On Apr 7, 2011, at 4:24 AM, Rotem, Nadav wrote:
> Please review the attached patch. I implemented two main optimizations:
> 1. Getelementptr (PTR, extract (vcast))) -> Getelementptr (PTR, cast (extract))) scalarize the casting of pointer index.
> This generates much better code in cases where the gep index comes from a vector.
This seems somewhat reasonable to me in concept. The code needs to follow the standards through. Please end comments with proper punctuation, don't evaluate GEP.getNumIndices() each time through the loop, put the "*" in the right place, fit in 80 columns etc.
More seriously, the code doesn't seem to have a reasonable cost model. What if the cast has multiple uses and is legal? You're turning one vector cast + a bunch of extracts into multiple extracts and multiple casts. It is far from clear that this is a good idea.
> 2. Extend the EvaluateInDifferentType and CanEvaluateXXX to support Extract/Insert/ShuffleElement instructions.
Similar comments. How do you know that you aren't destroying performance by changing long sequences of legal types and legal operations into illegal types/operations?
More information about the llvm-commits