[llvm-commits] [llvm] r80706 - /llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 1 11:50:55 PDT 2009
Author: lattner
Date: Tue Sep 1 13:50:55 2009
New Revision: 80706
URL: http://llvm.org/viewvc/llvm-project?rev=80706&view=rev
Log:
cleanup/simplify
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=80706&r1=80705&r2=80706&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Sep 1 13:50:55 2009
@@ -322,7 +322,7 @@
// Update the callgraph to know that the callsite has been transformed.
CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN);
-
+
// Update all users of sret parameter to extract value using extractvalue.
for (Value::use_iterator UI = FirstCArg->use_begin(),
UE = FirstCArg->use_end(); UI != UE; ) {
@@ -331,23 +331,19 @@
if (C2 && (C2 == Call))
continue;
- if (GetElementPtrInst *UGEP = dyn_cast<GetElementPtrInst>(U2)) {
- ConstantInt *Idx = dyn_cast<ConstantInt>(UGEP->getOperand(2));
- assert (Idx && "Unexpected getelementptr index!");
- Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(),
- "evi", UGEP);
- while(!UGEP->use_empty()) {
- // isSafeToUpdateAllCallers has checked that all GEP uses are
- // LoadInsts
- LoadInst *L = cast<LoadInst>(*UGEP->use_begin());
- L->replaceAllUsesWith(GR);
- L->eraseFromParent();
- }
- UGEP->eraseFromParent();
- continue;
+ GetElementPtrInst *UGEP = cast<GetElementPtrInst>(U2);
+ ConstantInt *Idx = cast<ConstantInt>(UGEP->getOperand(2));
+ Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(),
+ "evi", UGEP);
+ while(!UGEP->use_empty()) {
+ // isSafeToUpdateAllCallers has checked that all GEP uses are
+ // LoadInsts
+ LoadInst *L = cast<LoadInst>(*UGEP->use_begin());
+ L->replaceAllUsesWith(GR);
+ L->eraseFromParent();
}
-
- assert(0 && "Unexpected sret parameter use");
+ UGEP->eraseFromParent();
+ continue;
}
Call->eraseFromParent();
}
More information about the llvm-commits
mailing list