[llvm] [LLVM][Intrinsics] Print note if manual name matches default name (PR #164716)
    Rahul Joshi via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Oct 23 09:34:32 PDT 2025
    
    
  
================
@@ -278,15 +278,21 @@ CodeGenIntrinsic::CodeGenIntrinsic(const Record *R,
   TargetPrefix = R->getValueAsString("TargetPrefix");
   Name = R->getValueAsString("LLVMName").str();
 
+  std::string DerivedName = "llvm." + EnumName.str();
+  llvm::replace(DerivedName, '_', '.');
+
   if (Name == "") {
     // If an explicit name isn't specified, derive one from the DefName.
-    Name = "llvm." + EnumName.str();
-    llvm::replace(Name, '_', '.');
+    Name = std::move(DerivedName);
   } else {
     // Verify it starts with "llvm.".
     if (!StringRef(Name).starts_with("llvm."))
       PrintFatalError(DefLoc, "Intrinsic '" + DefName +
                                   "'s name does not start with 'llvm.'!");
+
+    if (Name == DerivedName)
+      PrintNote(DefLoc, "Explicitly specified name matches default name, "
----------------
jurahul wrote:
Added a unit test.
https://github.com/llvm/llvm-project/pull/164716
    
    
More information about the llvm-commits
mailing list