While trying to propagate AND masks back to loads, we currently allow one non-load node to be included as a leaf in chain. This fix now limits that node to produce only a single data value.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
I'm not familiar with this transform, but the proposal makes sense. But I think it would be easier to follow the logic if it was written as:
// Also ensure that the node to be masked only produces one data result. NodeToMask = Op.getNode(); unsigned DataValues = 0; for (unsigned i = 0; i < NodeToMask->getNumValues(); ++i) { MVT VT = SDValue(NodeToMask, i).getSimpleValueType(); if (VT != MVT::Glue && VT != MVT::Other) ++DataValues; if (DataValues > 1) { NodeToMask = nullptr; return false; } } assert(DataValues == 1 && "Node to be masked has no data result?");
Also, I added tests for both bugs (just in case there was logic difference there) with rL334199. Please use utils/update_llc_test_checks.py to update the assertions and rebase here.
Comment Actions
This also makes sense to me. Just to build on Sanjays comment, I think recasting DataValues as boolean is nicer.
NodeToMask = Op.getNode();
bool HasValue = false;
for (unsigned i = 0; i < NodeToMask->getNumValues(); ++i) {
MVT VT = SDValue(NodeToMask, i).getSimpleValueType(); if (VT != MVT::Glue && VT != MVT::Other){ if(HasValue) { NodeToMask = nullptr; return false; } HasValue = true;
}
Comment Actions
Thanks for the feedback. I've removed my new test and updated the existed one. Also modified the code style.
test/CodeGen/X86/backpropmask.ll | ||
---|---|---|
4 ↗ | (On Diff #150342) | Please remove this FIXME when committing. |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
4005 ↗ | (On Diff #150342) | Minor style issue: for (unsigned i = 0, e = NodeToMask->getNumValues(); i < e; ++i) { |