On Apr 6, 2007, at 10:51 AM, Reid Spencer wrote: > 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?"
The transform in CVS allows us to turn: %t = getelementptr float* cast ([2 x i32]* %str to float*), i32 %V %u = bitcast float* to i32* into this: %s = getelementptr [2 x i32]* %str, i32 0, i32 %V %t = bitcast i32* %s to float* %u = bitcast float* to i32* into this: %u = getelementptr [2 x i32]* %str, i32 0, i32 %V -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits