This port of the SDAG optimization is only for exact sdiv case.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | This greatly depends on the target handling of division and probably should be attached to the tablegen addition |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
5015 | Is this cuter as an if-statement to get rid of the (void)? |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | I mean GICombineRules should have predicate fields, analogous to PatFags |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | Is there a patch to do that already? |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | No, not that I'm aware of |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | Implementing the infrastructure for that seems a separate issue though? This kind of minsize check is mirroring the same check done for SelectionDAG. |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4963 | Just return C && !C->isNullValue()? | |
5004 | Use APInt::multiplicativeInverse instead? | |
5021 | Is this a way of testing whether the divisor is not a splat? It seems a bit hacky. If the divisor is a splat then we could have saved some work above by only computing the multiplicative inverse once. | |
5025 | How does this work? It seems like it would use a scalar shift amount for a vector shift, which is not allowed by MachineVerifier. |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4955–4958 | Yes. I didn't notice that check; I should probably look into finding a way to disable it there too |
Address comments, add test for non-splat and splat vector cases.
Fix a needed util function not having the right symbol name.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
5037 | Comment is misleading. You're shifting the dividend based on trailing zeros in the divisor, so we don't know that the value is even before shifting, and we don't know the LSB is one after shifting. |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4944 | This seems redundant given the call to matchUnaryPredicate below. (I don't think it's significantly cheaper than matchUnaryPredicate is it?) | |
5004 | Ping. Is there a reason not to use it? | |
5013 | Is zero extending really correct here? It feels dubious for a signed division but I'm not sure of the maths at this point. |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4944 | Yeah I think you're right. | |
5004 | I did below? | |
5013 | This is also getting beyond the realms on my expertise, but the documentation for it says that the inverse should always fit into the bit width, so extending and truncating shouldn’t affect the result in anyway. |
This seems redundant given the call to matchUnaryPredicate below. (I don't think it's significantly cheaper than matchUnaryPredicate is it?)