diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp b/contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp index 5dda96a2ca..e07b3c41e6 100644 --- a/contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp +++ b/contrib/libs/llvm12/lib/Analysis/MemoryBuiltins.cpp @@ -72,7 +72,7 @@ struct AllocFnsTy { // know which functions are nounwind, noalias, nocapture parameters, etc. static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = { {LibFunc_malloc, {MallocLike, 1, 0, -1}}, - {LibFunc_vec_malloc, {MallocLike, 1, 0, -1}}, + {LibFunc_vec_malloc, {MallocLike, 1, 0, -1}}, {LibFunc_valloc, {MallocLike, 1, 0, -1}}, {LibFunc_Znwj, {OpNewLike, 1, 0, -1}}, // new(unsigned int) {LibFunc_ZnwjRKSt9nothrow_t, {MallocLike, 2, 0, -1}}, // new(unsigned int, nothrow) @@ -104,9 +104,9 @@ static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = { {LibFunc_msvc_new_array_longlong_nothrow, {MallocLike, 2, 0, -1}}, // new[](unsigned long long, nothrow) {LibFunc_aligned_alloc, {AlignedAllocLike, 2, 1, -1}}, {LibFunc_calloc, {CallocLike, 2, 0, 1}}, - {LibFunc_vec_calloc, {CallocLike, 2, 0, 1}}, + {LibFunc_vec_calloc, {CallocLike, 2, 0, 1}}, {LibFunc_realloc, {ReallocLike, 2, 1, -1}}, - {LibFunc_vec_realloc, {ReallocLike, 2, 1, -1}}, + {LibFunc_vec_realloc, {ReallocLike, 2, 1, -1}}, {LibFunc_reallocf, {ReallocLike, 2, 1, -1}}, {LibFunc_strdup, {StrDupLike, 1, -1, -1}}, {LibFunc_strndup, {StrDupLike, 2, 1, -1}} @@ -381,8 +381,8 @@ PointerType *llvm::getMallocType(const CallInst *CI, unsigned NumOfBitCastUses = 0; // Determine if CallInst has a bitcast use. - for (const User *U : CI->users()) - if (const BitCastInst *BCI = dyn_cast<BitCastInst>(U)) { + for (const User *U : CI->users()) + if (const BitCastInst *BCI = dyn_cast<BitCastInst>(U)) { MallocType = cast<PointerType>(BCI->getDestTy()); NumOfBitCastUses++; } @@ -568,16 +568,16 @@ Value *llvm::lowerObjectSizeCall(IntrinsicInst *ObjectSize, Value *UseZero = Builder.CreateICmpULT(SizeOffsetPair.first, SizeOffsetPair.second); ResultSize = Builder.CreateZExtOrTrunc(ResultSize, ResultType); - Value *Ret = Builder.CreateSelect( - UseZero, ConstantInt::get(ResultType, 0), ResultSize); - - // The non-constant size expression cannot evaluate to -1. - if (!isa<Constant>(SizeOffsetPair.first) || - !isa<Constant>(SizeOffsetPair.second)) - Builder.CreateAssumption( - Builder.CreateICmpNE(Ret, ConstantInt::get(ResultType, -1))); - - return Ret; + Value *Ret = Builder.CreateSelect( + UseZero, ConstantInt::get(ResultType, 0), ResultSize); + + // The non-constant size expression cannot evaluate to -1. + if (!isa<Constant>(SizeOffsetPair.first) || + !isa<Constant>(SizeOffsetPair.second)) + Builder.CreateAssumption( + Builder.CreateICmpNE(Ret, ConstantInt::get(ResultType, -1))); + + return Ret; } } @@ -686,14 +686,14 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitAllocaInst(AllocaInst &I) { } SizeOffsetType ObjectSizeOffsetVisitor::visitArgument(Argument &A) { - Type *MemoryTy = A.getPointeeInMemoryValueType(); + Type *MemoryTy = A.getPointeeInMemoryValueType(); // No interprocedural analysis is done at the moment. - if (!MemoryTy|| !MemoryTy->isSized()) { + if (!MemoryTy|| !MemoryTy->isSized()) { ++ObjectVisitorArgument; return unknown(); } - - APInt Size(IntTyBits, DL.getTypeAllocSize(MemoryTy)); + + APInt Size(IntTyBits, DL.getTypeAllocSize(MemoryTy)); return std::make_pair(align(Size, A.getParamAlignment()), Zero); } |