[llvm] [ConstraintElim] Check the other signedness when hasSameSign (PR #128168)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 21 09:58:51 PST 2025
================
@@ -303,3 +303,43 @@ define i1 @ugt_assumed_positive_values(i8 %a, i8 %b) {
ret i1 %result
}
+
+define i1 @samesign_flipped_signedness_1(i8 %a, i8 %b) {
+; CHECK-LABEL: @samesign_flipped_signedness_1(
+; CHECK-NEXT: [[CMP_UGT:%.*]] = icmp ugt i8 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: br i1 [[CMP_UGT]], label [[GREATER:%.*]], label [[EXIT:%.*]]
+; CHECK: greater:
+; CHECK-NEXT: ret i1 true
+; CHECK: exit:
+; CHECK-NEXT: ret i1 false
+;
+ %cmp_ugt = icmp ugt i8 %a, %b
+ br i1 %cmp_ugt, label %greater, label %exit
+
+greater:
+ %cmp_sgt = icmp samesign sgt i8 %a, %b
----------------
artagnon wrote:
Sorry, I think I missed this earlier, but samesign is canonicalized with unsigned predicates.
https://github.com/llvm/llvm-project/pull/128168
More information about the llvm-commits
mailing list