Displaying 4 results from an estimated 4 matches for "malloc_206".
2007 Feb 13
2
[LLVMdev] Unused malloc/free don't get optimized
Hi, i have some code that allocate some memory, store the pointer to a
variable, read it back and deallocates it, like this:
int %main(int %argc, ubyte** %argv)
{
%c_19 = alloca ubyte*
%malloc_206 = malloc ubyte, uint 10
store ubyte* %malloc_206, ubyte** %c_19
%tmp_207 = load ubyte** %c_19
free ubyte* %tmp_207
ret int 0
}
i expected the optimized to remove everything, but after running it
the code i get is:
int %main(int %argc, ubyte** %argv) {
%malloc_206 = malloc [10 x ubyte]
%malloc...
2007 Feb 14
0
[LLVMdev] Unused malloc/free don't get optimized
...wrote:
> Hi, i have some code that allocate some memory, store the pointer to a
> variable, read it back and deallocates it, like this:
ok
> i expected the optimized to remove everything, but after running it
> the code i get is:
>
> int %main(int %argc, ubyte** %argv) {
> %malloc_206 = malloc [10 x ubyte]
> %malloc_206.sub = getelementptr [10 x ubyte]* %malloc_206, int 0, int 0
> free ubyte* %malloc_206.sub
> ret int 0
> }
>
> Why didn't he optimized it out?
This looks like a simple missed optimization.
> and where did that getelementptr came from?...
2007 Feb 14
2
[LLVMdev] Unused malloc/free don't get optimized
...some memory, store the pointer to a
> > variable, read it back and deallocates it, like this:
>
> ok
>
> > i expected the optimized to remove everything, but after running it
> > the code i get is:
> >
> > int %main(int %argc, ubyte** %argv) {
> > %malloc_206 = malloc [10 x ubyte]
> > %malloc_206.sub = getelementptr [10 x ubyte]* %malloc_206, int 0, int 0
> > free ubyte* %malloc_206.sub
> > ret int 0
> > }
> >
> > Why didn't he optimized it out?
>
> This looks like a simple missed optimizat...
2007 Feb 14
0
[LLVMdev] Unused malloc/free don't get optimized
...> variable, read it back and deallocates it, like this:
> >
> > ok
> >
> > > i expected the optimized to remove everything, but after running it
> > > the code i get is:
> > >
> > > int %main(int %argc, ubyte** %argv) {
> > > %malloc_206 = malloc [10 x ubyte]
> > > %malloc_206.sub = getelementptr [10 x ubyte]* %malloc_206, int 0, int 0
> > > free ubyte* %malloc_206.sub
> > > ret int 0
> > > }
> > >
> > > Why didn't he optimized it out?
> >
> > T...