[llvm] 342fea3 - [NewGVN] add test for commutative intrinsic; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 13:35:01 PDT 2020
Author: Sanjay Patel
Date: 2020-08-30T16:33:45-04:00
New Revision: 342fea366f907e09eb12b12cfdeba7e9a056c2a3
URL: https://github.com/llvm/llvm-project/commit/342fea366f907e09eb12b12cfdeba7e9a056c2a3
DIFF: https://github.com/llvm/llvm-project/commit/342fea366f907e09eb12b12cfdeba7e9a056c2a3.diff
LOG: [NewGVN] add test for commutative intrinsic; NFC
Added:
Modified:
llvm/test/Transforms/NewGVN/commute.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/NewGVN/commute.ll b/llvm/test/Transforms/NewGVN/commute.ll
index ab7541bd5024..d7737dd04f97 100644
--- a/llvm/test/Transforms/NewGVN/commute.ll
+++ b/llvm/test/Transforms/NewGVN/commute.ll
@@ -1,23 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -newgvn -S < %s | FileCheck %s
declare void @use(i32, i32)
-define void @foo(i32 %x, i32 %y) {
- ; CHECK-LABEL: @foo(
+define void @binop(i32 %x, i32 %y) {
+; CHECK-LABEL: @binop(
+; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: call void @use(i32 [[ADD1]], i32 [[ADD1]])
+; CHECK-NEXT: ret void
+;
%add1 = add i32 %x, %y
%add2 = add i32 %y, %x
call void @use(i32 %add1, i32 %add2)
- ; CHECK: @use(i32 %add1, i32 %add1)
ret void
}
declare void @vse(i1, i1)
-define void @bar(i32 %x, i32 %y) {
- ; CHECK-LABEL: @bar(
+define void @cmp(i32 %x, i32 %y) {
+; CHECK-LABEL: @cmp(
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: call void @vse(i1 [[CMP1]], i1 [[CMP1]])
+; CHECK-NEXT: ret void
+;
%cmp1 = icmp ult i32 %x, %y
%cmp2 = icmp ugt i32 %y, %x
call void @vse(i1 %cmp1, i1 %cmp2)
- ; CHECK: @vse(i1 %cmp1, i1 %cmp1)
ret void
}
+
+define void @intrinsic(i32 %x, i32 %y) {
+; CHECK-LABEL: @intrinsic(
+; CHECK-NEXT: [[M1:%.*]] = call i32 @llvm.smax.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-NEXT: [[M2:%.*]] = call i32 @llvm.smax.i32(i32 [[Y]], i32 [[X]])
+; CHECK-NEXT: call void @use(i32 [[M1]], i32 [[M2]])
+; CHECK-NEXT: ret void
+;
+ %m1 = call i32 @llvm.smax.i32(i32 %x, i32 %y)
+ %m2 = call i32 @llvm.smax.i32(i32 %y, i32 %x)
+ call void @use(i32 %m1, i32 %m2)
+ ret void
+}
+
+declare i32 @llvm.smax.i32(i32, i32)
More information about the llvm-commits
mailing list