Displaying 4 results from an estimated 4 matches for "extern_func".
2015 Mar 05
2
[LLVMdev] Optimizing out redundant alloca involving byval params
Hello all,
I'm trying to find the pass that would convert from:
define void @main(%struct* byval %ptr) {
%val = load %struct* %ptr
%val.ptr = alloca %struct
store %struct %val, %struct* %val.ptr
call void @extern_func(%struct* byval %val.ptr)
ret void
}
to this:
define void @main(%struct* byval %ptr) {
call void @extern_func(%struct* byval %ptr)
ret void
}
First, am I missing something - would this be a correct optimization?
Thank you,
Mircea.
-------------- next part --------------
An HTML attachment w...
2015 Mar 06
2
[LLVMdev] Optimizing out redundant alloca involving byval params
...te:
>
> Hello all,
>
> I'm trying to find the pass that would convert from:
>
> define void @main(%struct* byval %ptr) {
> %val = load %struct* %ptr
> %val.ptr = alloca %struct
> store %struct %val, %struct* %val.ptr
> call void @extern_func(%struct* byval %val.ptr)
> ret void
> }
>
> to this:
> define void @main(%struct* byval %ptr) {
> call void @extern_func(%struct* byval %ptr)
> ret void
> }
>
> First, am I missing something - would this be a correct optimization?...
2015 Mar 06
2
[LLVMdev] Optimizing out redundant alloca involving byval params
....index1
> %val.ptr = alloca %struct
> %val.ptr.index = getelementptr %struct* %val.ptr, i32 0, i32 0
> store i32 %val.field, i32* %val.ptr.index
> %val.ptr.index4 = getelementptr %struct* %val.ptr, i32 0, i32 1
> store i32 %val.field2, i32* %val.ptr.index4
> call void @extern_func(%struct* byval %val.ptr)
> ret void
> }
>
> If so, would you mind pointing me to the phase that would reduce this?
> (I'm assuming that's what you meant by "for free" - there's an
> existing phase I could use)
I would expect GVN to get this. If you can r...
2015 Mar 08
2
[LLVMdev] Optimizing out redundant alloca involving byval params
...ptr = alloca %struct
>> %val.ptr.index = getelementptr %struct* %val.ptr, i32 0, i32 0
>> store i32 %val.field, i32* %val.ptr.index
>> %val.ptr.index4 = getelementptr %struct* %val.ptr, i32 0, i32 1
>> store i32 %val.field2, i32* %val.ptr.index4
>> call void @extern_func(%struct* byval %val.ptr)
>> ret void
>> }
>>
>> If so, would you mind pointing me to the phase that would reduce this?
>> (I'm assuming that's what you meant by "for free" - there's an existing
>> phase I could use)
>>
>> I wo...