[PATCH] D84220: [IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is optimized to return undef

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 23:09:37 PDT 2020


congzhe updated this revision to Diff 283815.
congzhe added a comment.

Comments addressed:

replaced the if branch with assert(); replaced auto with Use in the for loop


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84220/new/

https://reviews.llvm.org/D84220

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SCCP.cpp
+++ llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -2052,11 +2052,9 @@
       F->removeParamAttr(A.getArgNo(), Attribute::Returned);
     for (Use &U : F->uses()) {
       CallBase *CB = dyn_cast<CallBase>(U.getUser());
-      if (!CB)
-	continue;
-      for (auto &arg : CB->args()) {
-        CB->removeParamAttr(CB->getArgOperandNo(&arg), Attribute::Returned);
-      }
+      assert(CB && "Use of zapped functions should be valid direct calls!");
+      for (Use &Arg : CB->args())
+        CB->removeParamAttr(CB->getArgOperandNo(&Arg), Attribute::Returned);
     }
   }
   // If we inferred constant or undef values for globals variables, we can


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84220.283815.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/695b2f00/attachment.bin>


More information about the llvm-commits mailing list