]> granicus.if.org Git - llvm/commitdiff
Fix memory issue in AttrBuilder::removeAttribute uses.
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 27 Oct 2016 14:48:09 +0000 (14:48 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 27 Oct 2016 14:48:09 +0000 (14:48 +0000)
Summary:
Found when running Valgrind.

This removes two unnecessary assignments when using
AttrBuilder::removeAttribute.

AttrBuilder::removeAttribute returns a reference to the object.
As the LHSes were the same as the callees, the assignments
resulted in memcpy calls where dst = src.

Commited on behalf-of: dstenb (David Stenberg)

Reviewers: mkuper, rnk

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25460

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285298 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Analysis.cpp

index 6582d24da828881e0cd952c907bf365ac4c60f1b..511360303797da928925e10654bd26937bca687b 100644 (file)
@@ -541,8 +541,8 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
 
   // Noalias is completely benign as far as calling convention goes, it
   // shouldn't affect whether the call is a tail call.
-  CallerAttrs = CallerAttrs.removeAttribute(Attribute::NoAlias);
-  CalleeAttrs = CalleeAttrs.removeAttribute(Attribute::NoAlias);
+  CallerAttrs.removeAttribute(Attribute::NoAlias);
+  CalleeAttrs.removeAttribute(Attribute::NoAlias);
 
   if (CallerAttrs.contains(Attribute::ZExt)) {
     if (!CalleeAttrs.contains(Attribute::ZExt))