[clang] [clang][RISCV] Fix the condition of checking signature in getIndex (PR #67403)

Jianjian Guan via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 01:37:53 PDT 2023


https://github.com/jacquesguan created https://github.com/llvm/llvm-project/pull/67403

The current condition causes assert failing if try to add a new vendor vector file which only contains the same type signature.

>From 3ad50442210c7303f0ac55339db778aa777532c8 Mon Sep 17 00:00:00 2001
From: Jianjian GUAN <jacquesguan at me.com>
Date: Tue, 26 Sep 2023 16:32:14 +0800
Subject: [PATCH] [clang][RISCV] Fix the condition of checking signature in
 getIndex

The current condition causes assert failing if try to add a new vendor vector file which only contains the same type signature.
---
 clang/utils/TableGen/RISCVVEmitter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index 41025926058ed07..c08e48b3f44dfe3 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -290,7 +290,7 @@ unsigned SemaSignatureTable::getIndex(ArrayRef<PrototypeDescriptor> Signature) {
     return 0;
 
   // Checking Signature already in table or not.
-  if (Signature.size() < SignatureTable.size()) {
+  if (Signature.size() <= SignatureTable.size()) {
     size_t Bound = SignatureTable.size() - Signature.size() + 1;
     for (size_t Index = 0; Index < Bound; ++Index) {
       if (equal(Signature.begin(), Signature.end(),



More information about the cfe-commits mailing list