[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
Fri Aug 7 09:02:36 PDT 2020
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2039
// Zap all returns which we've identified as zap to change.
+ SmallPtrSet<Function*, 8> FuncZappedReturn;
for (unsigned i = 0, e = ReturnsToZap.size(); i != e; ++i) {
----------------
Probably better to use SetVector, so the iteration order in the later loop is deterministic.
================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2044
+ // Record all functions that are zapped
+ if (FuncZappedReturn.find(F) == FuncZappedReturn.end())
+ FuncZappedReturn.insert(F);
----------------
I don't think you need the check, `insert` should only add the function if it is not already present.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84220/new/
https://reviews.llvm.org/D84220
More information about the llvm-commits
mailing list