[llvm] [ConstraintElim] Add missing checks in test_overflow_in_negate_constraint (PR #65841)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 9 00:47:02 PDT 2023


https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/65841:

This patch adds missing checks in the function `test_overflow_in_negate_constraint`.
Related commit: 0a0181dc2061fc60b309f231a5b2f6251046c552


>From 17b547a62ff80435d10bbbfd30a798b51a081385 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Sat, 9 Sep 2023 15:43:06 +0800
Subject: [PATCH] [ConstraintElim] Add missing check in
 test_overflow_in_negate_constraint

---
 llvm/test/Transforms/ConstraintElimination/overflows.ll | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/llvm/test/Transforms/ConstraintElimination/overflows.ll b/llvm/test/Transforms/ConstraintElimination/overflows.ll
index 1fd6bdbf6615bac..556ae0c56f9aad7 100644
--- a/llvm/test/Transforms/ConstraintElimination/overflows.ll
+++ b/llvm/test/Transforms/ConstraintElimination/overflows.ll
@@ -18,6 +18,14 @@ bb:
 }
 
 define i1 @test_overflow_in_negate_constraint(i8 %x, i64 %y) {
+; CHECK-LABEL: define i1 @test_overflow_in_negate_constraint
+; CHECK-SAME: (i8 [[X:%.*]], i64 [[Y:%.*]]) {
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    [[ZEXT:%.*]] = zext i8 [[X]] to i64
+; CHECK-NEXT:    [[SHL:%.*]] = shl nuw nsw i64 [[ZEXT]], 63
+; CHECK-NEXT:    [[ICMP:%.*]] = icmp uge i64 [[Y]], [[SHL]]
+; CHECK-NEXT:    ret i1 [[ICMP]]
+;
 bb:
   %zext = zext i8 %x to i64
   %shl = shl nuw nsw i64 %zext, 63



More information about the llvm-commits mailing list