As pointed out in D46528, we errneously transform cases like xor X, -1,
even though we use said function.
It's because the -1 is actually a bitcast there.
So i think we can just look through it in the function.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
916 ↗ | (On Diff #147841) | The comment next to the ISD::BITCAST declaration notes: /// This operator is subtly different from the bitcast instruction from /// LLVM-IR since this node may change the bits in the register. For /// example, this occurs on big-endian NEON and big-endian MSA where the /// layout of the bits in the register depends on the vector type and this /// operator acts as a shuffle operation for some vector type combinations. BITCAST, so i'm not too sure this is that simple, |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
917 ↗ | (On Diff #147841) | Don't make it recursive: while (N.getOpcode() == ISD::BITCAST) N = N->getOperand(0); |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
917 ↗ | (On Diff #147841) | Oh, i can do that? |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
917 ↗ | (On Diff #147841) | No, it;s fine - see ISD::isBuildVectorAllZeros - it might have been a problem if you weren't just interested in ALL bits being set. |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
916 ↗ | (On Diff #147847) | Use peekThroughBitcast() Should we do the same for isOneConstantOrOneSplatConstant and isNullConstantOrNullSplatConstant? |
Comment Actions
LGTM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
916 ↗ | (On Diff #147847) | Let's leave it until there is a test case - you can add TODO comments if you wish. |