[llvm-commits] [patch] minor instcombine+bitcast improvement

Reid Spencer rspencer at reidspencer.com
Fri Apr 6 10:51:42 PDT 2007


On Fri, 2007-04-06 at 10:45 -0700, Chris Lattner wrote:
> On Apr 6, 2007, at 9:01 AM, Dan Gohman wrote:
> 
> > This patch makes instcombine convert this:
> >
> >      %t = getelementptr float* cast ([2 x i32]* %str to float*),  
> > i32 %V
> >
> > into this:
> >
> >      %t = getelementptr float* cast ([2 x i32]* %str to [2 x float] 
> > *), i32 0, i32 %V
> >
> > instead of this:
> >
> >      %s = getelementptr [2 x i32]* %str, i32 0, i32 %V
> >      %t = bitcast i32* %s to float*
> >
> > I'm not yet familiar with instcombine's canonicalization style; is  
> > this
> > a desireable change? It doesn't cause any regressions for me.
> 
> I don't have a strong preference either way.  Is there a reason that  
> you prefer this style to the previous one?

That was my take too. 

I don't think this affects code gen at all so the only question is, what
else does it improve? It doesn't improve readability in my opinion but
that's not a high priority.  Using the cast constant expression instead
of the cast instruction might be smaller but I'm not sure. So, I have
the same question: "What's the benefit to this transform?"

Reid.

> 
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list