aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:49:05 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:49:05 +0000
commit2f12f10af369d468b14617276446166383d692ed (patch)
tree2caca31db4facdc95c23930c0c745c8ef0dee97d /lib/Transforms
parentc69102774f9739c81ae1285ed9ae62405071c63c (diff)
Notes
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp4
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp2
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp4
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp10
4 files changed, 16 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 7b1e9c0efdd1..d8e97a26ada8 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -622,12 +622,12 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V,
return false; // Storing the value.
}
} else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
- if (CI->getOperand(0) != V) {
+ if (CI->getCalledValue() != V) {
//cerr << "NONTRAPPING USE: " << **UI;
return false; // Not calling the ptr
}
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
- if (II->getOperand(0) != V) {
+ if (II->getCalledValue() != V) {
//cerr << "NONTRAPPING USE: " << **UI;
return false; // Not calling the ptr
}
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index bdb46ebd1a64..65f2e15d2780 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -820,7 +820,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
// We cannot remove an invoke, because it would change the CFG, just
// change the callee to a null pointer.
- cast<InvokeInst>(OldCall)->setOperand(0,
+ cast<InvokeInst>(OldCall)->setCalledFunction(
Constant::getNullValue(CalleeF->getType()));
return 0;
}
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index de93e9f621fe..eb04d9401fbb 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -307,6 +307,10 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L,
}
}
}
+
+ // The insertion point instruction may have been deleted; clear it out
+ // so that the rewriter doesn't trip over it later.
+ Rewriter.clearInsertPoint();
}
void IndVarSimplify::RewriteNonIntegerIVs(Loop *L) {
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index 05027ae528e3..22f3628cf7c0 100644
--- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -1400,6 +1400,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
setOnlyReadsMemory(F);
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
+ } else if (Name == "strchr" ||
+ Name == "strrchr") {
+ if (FTy->getNumParams() != 2 ||
+ !FTy->getParamType(0)->isPointerTy() ||
+ !FTy->getParamType(1)->isIntegerTy())
+ continue;
+ setOnlyReadsMemory(F);
+ setDoesNotThrow(F);
} else if (Name == "strcpy" ||
Name == "stpcpy" ||
Name == "strcat" ||
@@ -1428,7 +1436,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
} else if (Name == "strcmp" ||
Name == "strspn" ||
Name == "strncmp" ||
- Name ==" strcspn" ||
+ Name == "strcspn" ||
Name == "strcoll" ||
Name == "strcasecmp" ||
Name == "strncasecmp") {