[llvm-commits] [llvm] r52217 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/extractvalue.ll

Chris Lattner clattner at apple.com
Wed Jun 25 10:04:54 PDT 2008


On Jun 24, 2008, at 11:22 AM, Matthijs Kooijman wrote:

> Hi Chris,
>
>> X = call {a,b,c} @foo()
>>
>> %a = extract X, 0
>> %b = extract X, 1
>> %c = extract X, 2
>>
>>
>> %A = insert undef, %a, 0
>> %B = insert %A, %b, 1
>> %C = insert %B, %c, 2
>> call void @bar(%C)
> I have no intention to make instcombine change the above into a call  
> @bar(X)
> so that should work out. However, if the front end already emits  
> that, I don't
> think we will turn it into the above.

Ok.

> I have been playing with a though, however, of making a multiple  
> return
> canonicalize (or rather, a first class aggregate canonicalize) that  
> puts all
> extractvalue instructions directly after their aggregate argument and
> insertvalue instructions directly before their use. Also, it could  
> prevent
> aggregate return values from being used directly (ie, only through
> extractvalue) and force aggregate arguments to be built just before  
> a call
> using insertvalues. Not sure what the gain from this would be yet,  
> though, but
> it might make other passes slightly simpler.

I mainly care about keeping the compiler simple... canonical forms can  
be great for that!

> Also, I was planning on committing my flatten return value patch  
> sometime
> soon, which also makes things slightly less complicated :-)

Ok, cool.

>> Seem reasonable?
> I'll whip up something and we'll see what happens :-)

Thanks again Matthijs!

-Chris




More information about the llvm-commits mailing list