aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/AddrModeMatcher.cpp4
-rw-r--r--lib/Transforms/Utils/BuildLibCalls.cpp38
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp2
3 files changed, 22 insertions, 22 deletions
diff --git a/lib/Transforms/Utils/AddrModeMatcher.cpp b/lib/Transforms/Utils/AddrModeMatcher.cpp
index ea9d1c1b14..474b5fd578 100644
--- a/lib/Transforms/Utils/AddrModeMatcher.cpp
+++ b/lib/Transforms/Utils/AddrModeMatcher.cpp
@@ -382,7 +382,7 @@ static bool IsOperandAMemoryOperand(CallInst *CI, InlineAsm *IA, Value *OpVal,
std::vector<InlineAsm::ConstraintInfo>
Constraints = IA->ParseConstraints();
- unsigned ArgNo = 1; // ArgNo - The operand of the CallInst.
+ unsigned ArgNo = 0; // ArgNo - The operand of the CallInst.
for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
TargetLowering::AsmOperandInfo OpInfo(Constraints[i]);
@@ -450,7 +450,7 @@ static bool FindAllMemoryUses(Instruction *I,
if (CallInst *CI = dyn_cast<CallInst>(U)) {
InlineAsm *IA = dyn_cast<InlineAsm>(CI->getCalledValue());
- if (IA == 0) return true;
+ if (!IA) return true;
// If this is a memory operand, we're cool, otherwise bail out.
if (!IsOperandAMemoryOperand(CI, IA, I, TLI))
diff --git a/lib/Transforms/Utils/BuildLibCalls.cpp b/lib/Transforms/Utils/BuildLibCalls.cpp
index 767fa3a0a6..1e204305db 100644
--- a/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -395,11 +395,11 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
FT->getParamType(2) != TD->getIntPtrType(Context) ||
FT->getParamType(3) != TD->getIntPtrType(Context))
return false;
-
- if (isFoldable(4, 3, false)) {
- EmitMemCpy(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+
+ if (isFoldable(3, 2, false)) {
+ EmitMemCpy(CI->getOperand(0), CI->getOperand(1), CI->getOperand(2),
1, false, B, TD);
- replaceCall(CI->getOperand(1));
+ replaceCall(CI->getOperand(0));
return true;
}
return false;
@@ -418,11 +418,11 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
FT->getParamType(2) != TD->getIntPtrType(Context) ||
FT->getParamType(3) != TD->getIntPtrType(Context))
return false;
-
- if (isFoldable(4, 3, false)) {
- EmitMemMove(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+
+ if (isFoldable(3, 2, false)) {
+ EmitMemMove(CI->getOperand(0), CI->getOperand(1), CI->getOperand(2),
1, false, B, TD);
- replaceCall(CI->getOperand(1));
+ replaceCall(CI->getOperand(0));
return true;
}
return false;
@@ -436,12 +436,12 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
FT->getParamType(2) != TD->getIntPtrType(Context) ||
FT->getParamType(3) != TD->getIntPtrType(Context))
return false;
-
- if (isFoldable(4, 3, false)) {
- Value *Val = B.CreateIntCast(CI->getOperand(2), B.getInt8Ty(),
+
+ if (isFoldable(3, 2, false)) {
+ Value *Val = B.CreateIntCast(CI->getOperand(1), B.getInt8Ty(),
false);
- EmitMemSet(CI->getOperand(1), Val, CI->getOperand(3), false, B, TD);
- replaceCall(CI->getOperand(1));
+ EmitMemSet(CI->getOperand(0), Val, CI->getOperand(2), false, B, TD);
+ replaceCall(CI->getOperand(0));
return true;
}
return false;
@@ -462,8 +462,8 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
// st[rp]cpy_chk call which may fail at runtime if the size is too long.
// TODO: It might be nice to get a maximum length out of the possible
// string lengths for varying.
- if (isFoldable(3, 2, true)) {
- Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD,
+ if (isFoldable(2, 1, true)) {
+ Value *Ret = EmitStrCpy(CI->getOperand(0), CI->getOperand(1), B, TD,
Name.substr(2, 6));
replaceCall(Ret);
return true;
@@ -479,10 +479,10 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
!FT->getParamType(2)->isIntegerTy() ||
FT->getParamType(3) != TD->getIntPtrType(Context))
return false;
-
- if (isFoldable(4, 3, false)) {
- Value *Ret = EmitStrNCpy(CI->getOperand(1), CI->getOperand(2),
- CI->getOperand(3), B, TD, Name.substr(2, 7));
+
+ if (isFoldable(3, 2, false)) {
+ Value *Ret = EmitStrNCpy(CI->getOperand(0), CI->getOperand(1),
+ CI->getOperand(2), B, TD, Name.substr(2, 7));
replaceCall(Ret);
return true;
}
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 75c9ccdd7a..a7828a4cf2 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -66,7 +66,7 @@ static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
// Next, create the new invoke instruction, inserting it at the end
// of the old basic block.
- SmallVector<Value*, 8> InvokeArgs(CI->op_begin()+1, CI->op_end());
+ SmallVector<Value*, 8> InvokeArgs(CI->op_begin(), CI->op_end() - 1);
InvokeInst *II =
InvokeInst::Create(CI->getCalledValue(), Split, InvokeDest,
InvokeArgs.begin(), InvokeArgs.end(),