[PATCH] D84220: [IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is optimized to return undef
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 12:41:34 PDT 2020
fhahn added a comment.
Thanks for the patch! Some comments inline.
================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2042
+ for (Argument& A : F->args())
+ F->removeParamAttr(A.getArgNo(), Attribute::Returned);
}
----------------
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.
================
Comment at: llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll:11
+ %call = call i32 @func_return_undef(i32 1)
+; CHECK: {{call.*@func_return_undef}}
+ ret i32 0
----------------
Using a regular expression here looks a bit odd. Maybe `; CHECK: call {{.*}} @func_return_undef` or maybe even better spell out the full call? Also it might be good to return the result value `ret i32 %call` and check if it gets replaced with `1`.
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