aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/StructRetPromotion.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-01 18:50:55 +0000
committerChris Lattner <sabre@nondot.org>2009-09-01 18:50:55 +0000
commit7c8c1ba40ce54fa49c914352e2e19dcc849402b6 (patch)
tree75a5ea146535686d4e728685f732f9585270abdd /lib/Transforms/IPO/StructRetPromotion.cpp
parent2af658fcc093395b28a4533d8a01af308661b202 (diff)
cleanup/simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/StructRetPromotion.cpp')
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp
index 4c4c6d6828..7cb4c9f30c 100644
--- a/lib/Transforms/IPO/StructRetPromotion.cpp
+++ b/lib/Transforms/IPO/StructRetPromotion.cpp
@@ -322,7 +322,7 @@ CallGraphNode *SRETPromotion::updateCallSites(Function *F, Function *NF) {
// 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 @@ CallGraphNode *SRETPromotion::updateCallSites(Function *F, Function *NF) {
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();
}