[llvm] [SelectOpt] Support ADD and SUB with zext operands. (PR #115489)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 01:16:58 PST 2024


fhahn wrote:

> Hi - Yeah the heuristic is trying to do the best it can with the information it has, it just won't always be perfect. @igogo-x86 mentioned that this was something he was planning to add anyway, so it sounds OK as it will likely be added either here or in another patch. If it was me I might make it more conservative (maybe only do it if it was part of a larger select group), but I don't know of any cases where this will directly cause problems. The example above with i128 addition doesn't trigger on its own.
> 
> The sub issue still remains as I believe they will be treated like a commutative operation, so we would need to make sure it was the second operand that was the zext/sext.

Thanks, updated the patch after @igogo-x86 latest patch landing again, and I think the operands are added in the correct order (e.g. as in `test_sub_zext_first_op`)?

https://github.com/llvm/llvm-project/pull/115489


More information about the llvm-commits mailing list