[llvm] [CodeGen] Inline trivial TargetLoweringBase::getCmpLibcallReturnType method. NFC (PR #192483)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 09:20:21 PDT 2026


https://github.com/sbc100 created https://github.com/llvm/llvm-project/pull/192483

This trivial method makes more sense in the header (indeed, both the existing overrides for it are already in headers).

I noticed this while hunting for the default value while reviewing #192425

>From 943722bce3626a101bb6256ac675aadc47526385 Mon Sep 17 00:00:00 2001
From: Sam Clegg <sbc at chromium.org>
Date: Thu, 16 Apr 2026 09:01:52 -0700
Subject: [PATCH] [CodeGen] Inline trivial
 TargetLoweringBase::getCmpLibcallReturnType method. NFC

This trivial method makes more sense in the header (indeed, both the
existing overrides for it are already in headers).

I noticed this while hunting for the default value while reviewing #192425
---
 llvm/include/llvm/CodeGen/TargetLowering.h | 5 +++--
 llvm/lib/CodeGen/TargetLoweringBase.cpp    | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 59a0f2d2e0c2a..8aff327ee0e76 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -996,8 +996,9 @@ class LLVM_ABI TargetLoweringBase {
   /// Return the ValueType for comparison libcalls. Comparison libcalls include
   /// floating point comparison calls, and Ordered/Unordered check calls on
   /// floating point numbers.
-  virtual
-  MVT::SimpleValueType getCmpLibcallReturnType() const;
+  virtual MVT::SimpleValueType getCmpLibcallReturnType() const {
+    return MVT::i32; // return the default value
+  }
 
   /// For targets without i1 registers, this gives the nature of the high-bits
   /// of boolean values held in types wider than i1.
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 2f1e3f2f3ff7a..580c380a355a0 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1959,10 +1959,6 @@ EVT TargetLoweringBase::getSetCCResultType(const DataLayout &DL, LLVMContext &,
   return getPointerTy(DL).SimpleTy;
 }
 
-MVT::SimpleValueType TargetLoweringBase::getCmpLibcallReturnType() const {
-  return MVT::i32; // return the default value
-}
-
 /// getVectorTypeBreakdown - Vector types are broken down into some number of
 /// legal first class types.  For example, MVT::v8f32 maps to 2 MVT::v4f32
 /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.



More information about the llvm-commits mailing list