Allow scalable type dead store elimination in DAGCombine.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
19926–19927 | This looks really confusing. You can use TypeSize::isKnownLE, which also returns true when comparing sizes with different scalable properties, e.g. sizeof(v8i32) <= sizeof(nxv8i32). Ideally we'd extend BaseIndexOffset to handle scalable sizes as well, but that's quite a bit of work and may not be worth it. |
Dropped (STBitSize <= ChainBitSize) checks, it is not required as STBase.contains() ignores those to handle.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
19926–19927 | For scalable vectors, can you avoid the call to STBase.contains() entirely and just check that the pointer is equal? Then you don't have to make the effort to compute the 'known' part of the STBitSize/ChainBitSize. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
19915 | nit: unintended change? | |
19926 | I wonder if it's simpler to write this as follows: if (ST->getMemoryVT().isScalableVector() || ST1->getMemoryVT().isScalableVector()) { if (ST1->getBasePtr() == Ptr && TypeSize::isKnownLE(...)) CombineTo(ST1, ST1->getChain()); } else { const BaseIndexOffset STBase = BaseIndexOffset::match(ST, DAG); const BaseIndexOffset ChainBase = BaseIndexOffset::match(ST1, DAG); if (STBase.contains(...)) CombineTo(ST1, ST1->getChain()); } That way the the logic between 'anything scalable' and everything else is clearly separated. | |
llvm/test/CodeGen/AArch64/sve-redundant-store.ll | ||
21 | This is missing some test cases, e.g.
|
Thanks for adding the tests. Just two more minor comments and then I'm happy to accept.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
19931–19933 | Can you combine the two if-statements with an &&? That saves a level of indentation. | |
19939 | You can remove the } else { here, which saves a level of indentation. |
LGTM!
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
19931–19933 | Sorry, I misread the indentation/curly braces here. The original version was fine, thanks for restoring it! |
nit: unintended change?