[llvm] f6d411f - [LoongArch] Make function name in error message consistent with the user input. NFC

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 19:28:36 PST 2022


Author: gonglingqin
Date: 2022-11-21T10:54:12+08:00
New Revision: f6d411f557b83d369c782457aff5ace9753f46dd

URL: https://github.com/llvm/llvm-project/commit/f6d411f557b83d369c782457aff5ace9753f46dd
DIFF: https://github.com/llvm/llvm-project/commit/f6d411f557b83d369c782457aff5ace9753f46dd.diff

LOG: [LoongArch] Make function name in error message consistent with the user input. NFC

Added: 
    

Modified: 
    llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
    llvm/test/CodeGen/LoongArch/intrinsic-error.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index 5d170a0f3eaf7..13315c038c417 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -580,11 +580,11 @@ LoongArchTargetLowering::lowerINTRINSIC_W_CHAIN(SDValue Op,
 
 // Helper function that emits error message for intrinsics with void return
 // value.
-static SDValue emitIntrinsicErrorMessage(SDValue Op, StringRef Name,
-                                         StringRef ErrorMsg,
+static SDValue emitIntrinsicErrorMessage(SDValue Op, StringRef ErrorMsg,
                                          SelectionDAG &DAG) {
 
-  DAG.getContext()->emitError("argument to '" + Name + "' " + ErrorMsg);
+  DAG.getContext()->emitError("argument to '" + Op->getOperationName(0) + "' " +
+                              ErrorMsg);
   return Op.getOperand(0);
 }
 
@@ -603,8 +603,7 @@ SDValue LoongArchTargetLowering::lowerINTRINSIC_VOID(SDValue Op,
   case Intrinsic::loongarch_dbar: {
     unsigned Imm = cast<ConstantSDNode>(Op2)->getZExtValue();
     if (!isUInt<15>(Imm))
-      return emitIntrinsicErrorMessage(Op, "__builtin_loongarch_dbar",
-                                       ErrorMsgOOR, DAG);
+      return emitIntrinsicErrorMessage(Op, ErrorMsgOOR, DAG);
 
     return DAG.getNode(LoongArchISD::DBAR, DL, MVT::Other, Op0,
                        DAG.getConstant(Imm, DL, GRLenVT));
@@ -612,8 +611,7 @@ SDValue LoongArchTargetLowering::lowerINTRINSIC_VOID(SDValue Op,
   case Intrinsic::loongarch_ibar: {
     unsigned Imm = cast<ConstantSDNode>(Op2)->getZExtValue();
     if (!isUInt<15>(Imm))
-      return emitIntrinsicErrorMessage(Op, "__builtin_loongarch_ibar",
-                                       ErrorMsgOOR, DAG);
+      return emitIntrinsicErrorMessage(Op, ErrorMsgOOR, DAG);
 
     return DAG.getNode(LoongArchISD::IBAR, DL, MVT::Other, Op0,
                        DAG.getConstant(Imm, DL, GRLenVT));
@@ -621,8 +619,7 @@ SDValue LoongArchTargetLowering::lowerINTRINSIC_VOID(SDValue Op,
   case Intrinsic::loongarch_break: {
     unsigned Imm = cast<ConstantSDNode>(Op2)->getZExtValue();
     if (!isUInt<15>(Imm))
-      return emitIntrinsicErrorMessage(Op, "__builtin_loongarch_break",
-                                       ErrorMsgOOR, DAG);
+      return emitIntrinsicErrorMessage(Op, ErrorMsgOOR, DAG);
 
     return DAG.getNode(LoongArchISD::BREAK, DL, MVT::Other, Op0,
                        DAG.getConstant(Imm, DL, GRLenVT));
@@ -630,8 +627,7 @@ SDValue LoongArchTargetLowering::lowerINTRINSIC_VOID(SDValue Op,
   case Intrinsic::loongarch_syscall: {
     unsigned Imm = cast<ConstantSDNode>(Op2)->getZExtValue();
     if (!isUInt<15>(Imm))
-      return emitIntrinsicErrorMessage(Op, "__builtin_loongarch_syscall",
-                                       ErrorMsgOOR, DAG);
+      return emitIntrinsicErrorMessage(Op, ErrorMsgOOR, DAG);
 
     return DAG.getNode(LoongArchISD::SYSCALL, DL, MVT::Other, Op0,
                        DAG.getConstant(Imm, DL, GRLenVT));

diff  --git a/llvm/test/CodeGen/LoongArch/intrinsic-error.ll b/llvm/test/CodeGen/LoongArch/intrinsic-error.ll
index 76773040a3ff3..053df872da909 100644
--- a/llvm/test/CodeGen/LoongArch/intrinsic-error.ll
+++ b/llvm/test/CodeGen/LoongArch/intrinsic-error.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s
 ; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
 
@@ -7,56 +8,56 @@ declare void @llvm.loongarch.break(i32)
 declare void @llvm.loongarch.syscall(i32)
 
 define void @dbar_imm_out_of_hi_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_dbar' out of range
+; CHECK: argument to 'llvm.loongarch.dbar' out of range
 entry:
   call void @llvm.loongarch.dbar(i32 32769)
   ret void
 }
 
 define void @dbar_imm_out_of_lo_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_dbar' out of range
+; CHECK: argument to 'llvm.loongarch.dbar' out of range
 entry:
   call void @llvm.loongarch.dbar(i32 -1)
   ret void
 }
 
 define void @ibar_imm_out_of_hi_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_ibar' out of range
+; CHECK: argument to 'llvm.loongarch.ibar' out of range
 entry:
   call void @llvm.loongarch.ibar(i32 32769)
   ret void
 }
 
 define void @ibar_imm_out_of_lo_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_ibar' out of range
+; CHECK: argument to 'llvm.loongarch.ibar' out of range
 entry:
   call void @llvm.loongarch.ibar(i32 -1)
   ret void
 }
 
 define void @break_imm_out_of_hi_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_break' out of range
+; CHECK: argument to 'llvm.loongarch.break' out of range
 entry:
   call void @llvm.loongarch.break(i32 32769)
   ret void
 }
 
 define void @break_imm_out_of_lo_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_break' out of range
+; CHECK: argument to 'llvm.loongarch.break' out of range
 entry:
   call void @llvm.loongarch.break(i32 -1)
   ret void
 }
 
 define void @syscall_imm_out_of_hi_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_syscall' out of range
+; CHECK: argument to 'llvm.loongarch.syscall' out of range
 entry:
   call void @llvm.loongarch.syscall(i32 32769)
   ret void
 }
 
 define void @syscall_imm_out_of_lo_range() nounwind {
-; CHECK: argument to '__builtin_loongarch_syscall' out of range
+; CHECK: argument to 'llvm.loongarch.syscall' out of range
 entry:
   call void @llvm.loongarch.syscall(i32 -1)
   ret void


        


More information about the llvm-commits mailing list