[llvm] f557672 - [Reassociate] Add tests with disjoint OR.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat May 17 13:23:18 PDT 2025
Author: Florian Hahn
Date: 2025-05-17T21:23:12+01:00
New Revision: f5576729a4e26d62ba183a9443025f00ebdcc1e9
URL: https://github.com/llvm/llvm-project/commit/f5576729a4e26d62ba183a9443025f00ebdcc1e9
DIFF: https://github.com/llvm/llvm-project/commit/f5576729a4e26d62ba183a9443025f00ebdcc1e9.diff
LOG: [Reassociate] Add tests with disjoint OR.
Added:
llvm/test/Transforms/Reassociate/or-disjoint.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Reassociate/or-disjoint.ll b/llvm/test/Transforms/Reassociate/or-disjoint.ll
new file mode 100644
index 0000000000000..777836ed98152
--- /dev/null
+++ b/llvm/test/Transforms/Reassociate/or-disjoint.ll
@@ -0,0 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=reassociate -S %s | FileCheck %s
+
+
+define i16 @or_disjoint_both(i16 %a, i16 %b) {
+; CHECK-LABEL: @or_disjoint_both(
+; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
+; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
+; CHECK-NEXT: ret i16 [[OR_2]]
+;
+ %or.1 = or disjoint i16 %b, %a
+ %or.2 = or disjoint i16 %or.1, 1
+ ret i16 %or.2
+}
+
+define i16 @or_disjoint_first(i16 %a, i16 %b) {
+; CHECK-LABEL: @or_disjoint_first(
+; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
+; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
+; CHECK-NEXT: ret i16 [[OR_2]]
+;
+ %or.1 = or i16 %b, %a
+ %or.2 = or disjoint i16 %or.1, 1
+ ret i16 %or.2
+}
+
+define i16 @or_disjoint_last(i16 %a, i16 %b) {
+; CHECK-LABEL: @or_disjoint_last(
+; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
+; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
+; CHECK-NEXT: ret i16 [[OR_2]]
+;
+ %or.1 = or disjoint i16 %b, %a
+ %or.2 = or i16 %or.1, 1
+ ret i16 %or.2
+}
+
More information about the llvm-commits
mailing list