[llvm] [InstCombine] fold `sub(zext(ptrtoint), zext(ptrtoint))` (PR #115369)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 03:00:06 PST 2024


================
@@ -2631,6 +2631,21 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
                                                /* IsNUW */ false))
       return replaceInstUsesWith(I, Res);
 
+  if (match(Op0, m_ZExt(m_PtrToInt(m_Value(LHSOp)))) &&
+      match(Op1, m_ZExtOrSelf(m_PtrToInt(m_Value(RHSOp))))) {
----------------
nikic wrote:

We don't have a one-use check for the generic cases above, so I'd say "no" for now at least.

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


More information about the llvm-commits mailing list