[llvm] [GlobalISel] Check width of APInts in Reassoc PtrAdd combine (PR #84335)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 05:50:06 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
----------------
jayfoad wrote:
If #84352 is accepted then this won't be necessary - you can rely on C1 and C2 both having the correct (same) width already.
https://github.com/llvm/llvm-project/pull/84335
More information about the llvm-commits
mailing list