Slightly improves the precision of GlobalsAA in certain situations, and makes the behavior of optimization passes more predictable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Analysis/GlobalsModRef.cpp | ||
---|---|---|
277 | Don't know enough about GlobalsAA to approve this anyway, but as a matter of principle - is it acceptable for an analysis pass to modify the IR? |
lib/Analysis/GlobalsModRef.cpp | ||
---|---|---|
277 | No, they shouldn't. |
Marking as requiring changes to get this out of my phabricator queue. I think @mkuper 's comment on not modifying IR from analyses is a blocker.
Random drop-by comment.
test/Analysis/GlobalsModRef/dead-uses.ll | ||
---|---|---|
38 | There is no #0 in the file. |
lib/Analysis/GlobalsModRef.cpp | ||
---|---|---|
369 | How about pulling this out of the loop? That is, do: if (auto *C = dyn_cast<Constant>(V)) if (!C->isConstantUsed()) return false; | |
test/Analysis/GlobalsModRef/dead-uses.ll | ||
11 | Some more context here will be helpful -- are you trying to check if the load was hoisted out of the loop? If so, then a CHECK: entry: before the load will be nice (since there are two instances of br label %for.inc). |
lib/Analysis/GlobalsModRef.cpp | ||
---|---|---|
369 | That wouldn't work... say V is the global @a (with live loads and stores which access it), and I is a constant expression ptrtoint @a to i32. We want to ignore I if it's dead; checking V is useless. | |
test/Analysis/GlobalsModRef/dead-uses.ll | ||
11 | Yes; I'll change this to make that more clear. |
Don't know enough about GlobalsAA to approve this anyway, but as a matter of principle - is it acceptable for an analysis pass to modify the IR?