diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 9 | 
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index ef4cc227222..cb1021dae33 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -460,6 +460,9 @@ Value *LibCallSimplifier::optimizeStrCpy(CallInst *CI, IRBuilder<> &B) {    if (Dst == Src) // strcpy(x,x)  -> x      return Src; +  CI->addParamAttr(0, Attribute::NoAlias); +  CI->addParamAttr(1, Attribute::NoAlias); +    // See if we can get the length of the input string.    uint64_t Len = GetStringLength(Src);    if (Len == 0) @@ -502,6 +505,9 @@ Value *LibCallSimplifier::optimizeStrNCpy(CallInst *CI, IRBuilder<> &B) {    Value *Src = CI->getArgOperand(1);    Value *LenOp = CI->getArgOperand(2); +  CI->addParamAttr(0, Attribute::NoAlias); +  CI->addParamAttr(1, Attribute::NoAlias); +    // See if we can get the length of the input string.    uint64_t SrcLen = GetStringLength(Src);    if (SrcLen == 0) @@ -983,6 +989,9 @@ Value *LibCallSimplifier::optimizeMemCpy(CallInst *CI, IRBuilder<> &B,    if (ConstantInt *LenC = dyn_cast<ConstantInt>(Size))      annotateDereferenceableBytes(CI, {0, 1}, LenC->getZExtValue()); +  CI->addParamAttr(0, Attribute::NoAlias); +  CI->addParamAttr(1, Attribute::NoAlias); +    if (isIntrinsic)      return nullptr;  | 

