[llvm] 5762133 - [X86][GISel] Add initial tests for x86 postleg combiner (#183844)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 05:16:55 PST 2026
Author: Gergo Stomfai
Date: 2026-03-06T14:16:50+01:00
New Revision: 576213343f791899c0d94e93ff2e515b1af02eb4
URL: https://github.com/llvm/llvm-project/commit/576213343f791899c0d94e93ff2e515b1af02eb4
DIFF: https://github.com/llvm/llvm-project/commit/576213343f791899c0d94e93ff2e515b1af02eb4.diff
LOG: [X86][GISel] Add initial tests for x86 postleg combiner (#183844)
Moved over from AArch64 backend with adjusted registers.
Added:
llvm/test/CodeGen/X86/GlobalISel/postlegalizer-combiner-identity.mir
Modified:
llvm/lib/Target/X86/X86TargetMachine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index a71ec74ebc9b8..5305b39cffefd 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -108,6 +108,7 @@ extern "C" LLVM_C_ABI void LLVMInitializeX86Target() {
initializeX86SuppressAPXForRelocationLegacyPass(PR);
initializeX86WinEHUnwindV2LegacyPass(PR);
initializeX86PreLegalizerCombinerPass(PR);
+ initializeX86PostLegalizerCombinerPass(PR);
}
static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
diff --git a/llvm/test/CodeGen/X86/GlobalISel/postlegalizer-combiner-identity.mir b/llvm/test/CodeGen/X86/GlobalISel/postlegalizer-combiner-identity.mir
new file mode 100644
index 0000000000000..5186ef64284f9
--- /dev/null
+++ b/llvm/test/CodeGen/X86/GlobalISel/postlegalizer-combiner-identity.mir
@@ -0,0 +1,26 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple x86_64 -run-pass=X86-postlegalizer-combiner %s -o - | FileCheck %s
+
+---
+name: shift_of_zero
+alignment: 4
+legalized: true
+liveins:
+ - { reg: '$eax' }
+body: |
+ bb.1.entry:
+ liveins: $rax
+
+ ; CHECK-LABEL: name: shift_of_zero
+ ; CHECK: liveins: $rax
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: %a:_(s64) = COPY $rax
+ ; CHECK-NEXT: $rax = COPY %a(s64)
+ ; CHECK-NEXT: RET implicit $rax
+ %a:_(s64) = COPY $rax
+ %b:_(s64) = G_CONSTANT i64 0
+ %res:_(s64) = G_LSHR %a, %b
+ $rax = COPY %res(s64)
+ RET implicit $rax
+
+...
More information about the llvm-commits
mailing list