[llvm] [SDAG][X86] Merge MMOs when reusing morphed node (PR #206700)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 01:02:59 PDT 2026
================
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -mtriple=x86_64-- -stop-after=x86-isel < %s | FileCheck %s
+
+declare void @use(i32, i16)
+
+; Should retain both the s32 and s16 MMOs here.
+define void @test(ptr %p) nounwind {
+ ; CHECK-LABEL: name: test
+ ; CHECK: bb.0 (%ir-block.0):
+ ; CHECK-NEXT: liveins: $rdi
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
+ ; CHECK-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm [[COPY]], 1, $noreg, 0, $noreg :: (load (s32) from %ir.p), (load (s16) from %ir.p, align 4)
----------------
nikic wrote:
I don't think that's how MMOs work? The MMOs are just all the locations that may be accessed by the instruction. They don't have a correspondence to specific instruction operands.
See cloneMergedMemRefs() for the generic helper for merging MMOs at the MI level, used e.g. by BranchFolder::mergeCommonTails(). If you have two load instructions with different MMOs that get merged into one instruction, this is done by retaining both MMOs.
https://github.com/llvm/llvm-project/pull/206700
More information about the llvm-commits
mailing list