[llvm] [GlobalISel] Combine G_MERGE_VALUES of x and undef (PR #113616)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 25 10:00:05 PDT 2024
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
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>
================
@@ -2916,8 +2916,11 @@ void CombinerHelper::replaceInstWithFConstant(MachineInstr &MI, double C) {
void CombinerHelper::replaceInstWithConstant(MachineInstr &MI, int64_t C) {
assert(MI.getNumDefs() == 1 && "Expected only one def?");
- Builder.buildConstant(MI.getOperand(0), C);
- MI.eraseFromParent();
+ LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
+ if (isLegalOrBeforeLegalizer({TargetOpcode::G_CONSTANT, {DstTy}})) {
+ Builder.buildConstant(MI.getOperand(0), C);
+ MI.eraseFromParent();
+ }
----------------
aemerson wrote:
Please take a step back to address the root causes of the issues.
We can't be just not doing what the function says it would do. This change needs its own rationale or PR if it is indeed the right change to do.
https://github.com/llvm/llvm-project/pull/113616
More information about the llvm-commits
mailing list