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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 12:56:15 PDT 2020


jdoerfert added a comment.

I'm not sure I understand the motivation. My problem is that if we replace the return values with undef, it should mean there is no use of the returned value of the function live anymore. What am I missing? Maybe provide the motivating example as a test case?



================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2042
+    for (Argument& A : F->args())
+      F->removeParamAttr(A.getArgNo(), Attribute::Returned);
   }
----------------
fhahn wrote:
> A single function can have multiple returns to 'zap' and we would repeatedly checked the same function unnecessarily. 
> 
> It might be better to remove the returned argument once for each function we found returns to zap. This could either be done by checking if findReturnsToZap found returns to zap or by collecting a set of functions for which zapped returns and then remove the Returned attribute for their arguments.
call sites can have the attribute too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84220



More information about the llvm-commits mailing list