]> granicus.if.org Git - llvm/commitdiff
[SimplifyLibCalls] Fix -Wunused-result after D53342/r372091
authorFangrui Song <maskray@google.com>
Tue, 17 Sep 2019 09:56:55 +0000 (09:56 +0000)
committerFangrui Song <maskray@google.com>
Tue, 17 Sep 2019 09:56:55 +0000 (09:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372096 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SimplifyLibCalls.cpp

index 9dfb016ded24329c80424b8c0f07170416aeecea..526988d6d89842d561d76106b7e4cd8617026cea 100644 (file)
@@ -612,7 +612,8 @@ Value *LibCallSimplifier::optimizeStrNCpy(CallInst *CI, IRBuilder<> &B) {
     // strncpy(x, "", y) -> memset(align 1 x, '\0', y)
     CallInst *NewCI = B.CreateMemSet(Dst, B.getInt8('\0'), Size, 1);
     AttrBuilder ArgAttrs(CI->getAttributes().getParamAttributes(0));
-    NewCI->getAttributes().addParamAttributes(CI->getContext(), 0, ArgAttrs);
+    NewCI->setAttributes(NewCI->getAttributes().addParamAttributes(
+        CI->getContext(), 0, ArgAttrs));
     return Dst;
   }