[llvm-commits] [llvm] r47897 - /llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
Devang Patel
dpatel at apple.com
Tue Mar 4 11:22:54 PST 2008
Author: dpatel
Date: Tue Mar 4 13:22:54 2008
New Revision: 47897
URL: http://llvm.org/viewvc/llvm-project?rev=47897&view=rev
Log:
Use appropriate index to get the result value.
Modified:
llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=47897&r1=47896&r2=47897&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Mar 4 13:22:54 2008
@@ -302,7 +302,9 @@
if (C2 && (C2 == Call))
continue;
else if (GetElementPtrInst *UGEP = dyn_cast<GetElementPtrInst>(U2)) {
- Value *GR = new GetResultInst(New, 5, "xxx", UGEP);
+ ConstantInt *Idx = dyn_cast<ConstantInt>(UGEP->getOperand(2));
+ assert (Idx && "Unexpected getelementptr index!");
+ Value *GR = new GetResultInst(New, Idx->getZExtValue(), "gr", UGEP);
for (Value::use_iterator GI = UGEP->use_begin(),
GE = UGEP->use_end(); GI != GE; ++GI) {
if (LoadInst *L = dyn_cast<LoadInst>(*GI)) {
More information about the llvm-commits
mailing list