[PATCH] D99138: [deref] Infer a few more cases of global dereferenceability in a callee
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 23 04:33:40 PDT 2021
nlopes added inline comments.
================
Comment at: llvm/lib/IR/Value.cpp:758
+ // in practice as we don't infer nosync, but do infer readonly.)
+ if (F->onlyReadsMemory())
+ return false;
----------------
This is why I prefer atomic predicates. This if is duplicated to the code above.
If a function is readonly, doesNotFreeMemory() & hasNoSync() should return true. Otherwise we need to replicate this reasoning all over, which is going to end up with inconsistent semantics in different places.
So we are building some technical debt here..
EDIT: just checked Function.h and we have this:
bool doesNotFreeMemory() const {
return onlyReadsMemory() || hasFnAttribute(Attribute::NoFree);
}
So I guess we only need to patch hasNoSync().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99138/new/
https://reviews.llvm.org/D99138
More information about the llvm-commits
mailing list