[PATCH] D42612: [GlobalOpt] Improve common case efficiency of static global initializer evaluation
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 31 14:30:34 PST 2018
aemerson added inline comments.
================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:2339
+ Type *Ty = Init->getType();
+ if (Update) {
+ if (CurrentGV) {
----------------
Gerolf wrote:
> Update && CurrentGV?
I've simplified it to this since there's 4 possible cases:
1) First iteration: Update is true (GV != CurrentGV) and CurrentGV == nullptr.
2) Same GV as existing cache: Update is false (GV == CurrentGV), CurrentGV != nullptr;
2) New GV so committing cache: Update is true (GV != CurrentGV) and CurrentGV != nullptr.
3) Last iteration: Update forced to true, CurrentGV != nullptr.
Because of case 1 we shouldn't check for `&& CurrentGV`
Repository:
rL LLVM
https://reviews.llvm.org/D42612
More information about the llvm-commits
mailing list