Use early returns to reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234057 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2015-04-03 21:32:06 +00:00
parent 33b9ae320a
commit 4615ac61c5

View File

@@ -2284,10 +2284,12 @@ Value *FortifiedLibCallSimplifier::optimizeStrpCpyChk(CallInst *CI,
// st[rp]cpy_chk call which may fail at runtime if the size is too long. // 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 // TODO: It might be nice to get a maximum length out of the possible
// string lengths for varying. // string lengths for varying.
if (isFortifiedCallFoldable(CI, 2, 1, true)) { if (isFortifiedCallFoldable(CI, 2, 1, true))
Value *Ret = EmitStrCpy(Dst, Src, B, TLI, Name.substr(2, 6)); return EmitStrCpy(Dst, Src, B, TLI, Name.substr(2, 6));
return Ret;
} else if (!OnlyLowerUnknownSize) { if (OnlyLowerUnknownSize)
return nullptr;
// Maybe we can stil fold __st[rp]cpy_chk to __memcpy_chk. // Maybe we can stil fold __st[rp]cpy_chk to __memcpy_chk.
uint64_t Len = GetStringLength(Src); uint64_t Len = GetStringLength(Src);
if (Len == 0) if (Len == 0)
@@ -2301,8 +2303,6 @@ Value *FortifiedLibCallSimplifier::optimizeStrpCpyChk(CallInst *CI,
if (Ret && Func == LibFunc::stpcpy_chk) if (Ret && Func == LibFunc::stpcpy_chk)
return B.CreateGEP(B.getInt8Ty(), Dst, ConstantInt::get(SizeTTy, Len - 1)); return B.CreateGEP(B.getInt8Ty(), Dst, ConstantInt::get(SizeTTy, Len - 1));
return Ret; return Ret;
}
return nullptr;
} }
Value *FortifiedLibCallSimplifier::optimizeStrpNCpyChk(CallInst *CI, Value *FortifiedLibCallSimplifier::optimizeStrpNCpyChk(CallInst *CI,