Puzzled by results of -O3

Hi,

I'm trying to figure out why the following sequence of intructions is
not collapsed to "ret i32 0" by the opt tool with "-03".

Stephan <stephan.reiter@gmail.com> writes:

store [1 x i32] zeroinitializer, [1 x i32]* %tmp4

If I replace this with

%tmp6 = bitcast [1 x i32]* %tmp4 to i32* ; <[1 x i32]*>[#uses=1]
store i32 0, i32* %tmp6

then "opt -gvn" alone is enough figure out "ret i32 0".

Hi Stephan,

I'm trying to figure out why the following sequence of intructions is
not collapsed to "ret i32 0" by the opt tool with "-03".

no target data maybe?

Ciao,

Duncan.

Hmmm, my jitter-based application, which spit out this piece of code,
adds target data to the passmanager that's used to carry out code
optimizations. So, I think I've got this covered.

It's interesting that Timo's approach with a single-value store
instead of an aggregate store works. Could it be possible that a type
mismatch (pointer to array of ints vs. pointer to int(s)) breaks GVN?

Stephan