[llvm] [CodeGen] Simplify EVT::operator!=. NFCI. (PR #184792)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 05:23:09 PST 2026


https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/184792

This is based on the assumption that LLVMTy should be nullptr if and
only if the EVT is simple.


>From 24e94ceef1db73e10ef7923fd59316b3e312e8e3 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 5 Mar 2026 13:21:10 +0000
Subject: [PATCH] [CodeGen] Simplify EVT::operator!=. NFCI.

This is based on the assumption that LLVMTy should be nullptr if and
only if the EVT is simple.
---
 llvm/include/llvm/CodeGen/ValueTypes.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/llvm/include/llvm/CodeGen/ValueTypes.h b/llvm/include/llvm/CodeGen/ValueTypes.h
index 3897cb8c18127..5e1c9901a6255 100644
--- a/llvm/include/llvm/CodeGen/ValueTypes.h
+++ b/llvm/include/llvm/CodeGen/ValueTypes.h
@@ -46,11 +46,7 @@ namespace llvm {
       return !(*this != VT);
     }
     bool operator!=(EVT VT) const {
-      if (V.SimpleTy != VT.V.SimpleTy)
-        return true;
-      if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
-        return LLVMTy != VT.LLVMTy;
-      return false;
+      return V.SimpleTy != VT.V.SimpleTy || LLVMTy != VT.LLVMTy;
     }
 
     /// Returns the EVT that represents a floating-point type with the given



More information about the llvm-commits mailing list