[llvm] [GlobalISel] Check width of APInts in Reassoc PtrAdd combine (PR #84335)

Mirko BrkuĊĦanin via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 06:16:50 PST 2024


================
@@ -4652,14 +4652,16 @@ bool CombinerHelper::matchReassocFoldConstantsInSubTree(GPtrAdd &MI,
   if (!C2)
     return false;
 
-  // If constant widths differ pick larger one.
-  unsigned BitWidth = std::max(C1->getBitWidth(), C2->getBitWidth());
-  APInt NewConst = C1->sext(BitWidth) + C2->sext(BitWidth);
-  LLT Type =
-      MRI.getType(C1->getBitWidth() > C2->getBitWidth() ? LHSSrc2 : Src2Reg);
+  // Pick correct size for the constant based on the address space
----------------
mbrkusanin wrote:

Ok then

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


More information about the llvm-commits mailing list