[llvm] [GlobalISel] Combine G_MERGE_VALUES of x and undef (PR #113616)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 22:38:12 PDT 2024
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/113616 at github.com>
================
@@ -33,10 +33,13 @@ bool CombinerHelper::matchMergeXAndUndef(const MachineInstr &MI,
const GMerge *Merge = cast<GMerge>(&MI);
Register Dst = Merge->getReg(0);
- Register Undef = Merge->getSourceReg(1);
LLT DstTy = MRI.getType(Dst);
LLT SrcTy = MRI.getType(Merge->getSourceReg(0));
+ // Otherwise, we would miscompile.
+ if (Merge->getNumSources() > 2)
+ return false;
+
----------------
aemerson wrote:
It should still be assert, because this precondition should hold and if the assert breaks then we definitely need to know.
https://github.com/llvm/llvm-project/pull/113616
More information about the llvm-commits
mailing list