[llvm] IR: fix getSwappedCmpPredicate() return type (PR #120097)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 07:30:36 PST 2024


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/120097

The change 51a895a (IR: introduce struct with CmpInst::Predicate and samesign) missed a change to ICmpInst::getSwappedCmpPredicate(), which intends to return a CmpPredicate, but returns a Predicate instead. Fix this.

>From 908e57d3a3f44b280d6e3e46d90623010b19fbb9 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Mon, 16 Dec 2024 15:23:37 +0000
Subject: [PATCH] IR: fix getSwappedCmpPredicate() return type

The change 51a895a (IR: introduce struct with CmpInst::Predicate and
samesign) missed a change to ICmpInst::getSwappedCmpPredicate(), which
intends to return a CmpPredicate, but returns a Predicate instead. Fix
this.
---
 llvm/include/llvm/IR/Instructions.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index a42bf6bca1b9fb..a8df12a1282fcc 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1226,9 +1226,9 @@ class ICmpInst: public CmpInst {
     return {getSwappedPredicate(Pred), Pred.hasSameSign()};
   }
 
-  /// @returns the swapped predicate.
-  Predicate getSwappedCmpPredicate() const {
-    return getSwappedPredicate(getCmpPredicate());
+  /// @returns the swapped predicate along with samesign information.
+  CmpPredicate getSwappedCmpPredicate() const {
+    return getSwappedCmpPredicate(getCmpPredicate());
   }
 
   /// For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.



More information about the llvm-commits mailing list