diff --git a/llvm/test/TableGen/intrinsic-overload-conflict.td b/llvm/test/TableGen/intrinsic-overload-conflict.td index 84333119d41f5..13431c3bc49e0 100644 --- a/llvm/test/TableGen/intrinsic-overload-conflict.td +++ b/llvm/test/TableGen/intrinsic-overload-conflict.td @@ -6,13 +6,17 @@ include "llvm/IR/Intrinsics.td" // CHECK: foo = 1, def int_foo : Intrinsic<[llvm_any_ty]>; -// No conflicts, since .bar is not a vaid mangled type. +// No conflicts, since .bar is not a valid mangled type. // CHECK: foo_bar, def int_foo_bar : Intrinsic<[llvm_i32_ty]>; // CHECK: foo_bar_f32, def int_foo_bar_f32 : Intrinsic<[llvm_i32_ty]>; +// No conflicts, since i is not a valid mangled type without a bitwidth. +// CHECK: foo_i +def int_foo_i : Intrinsic<[llvm_i32_ty]>; + #ifdef CONFLICT // CHECK-CONFLICT: error: intrinsic `llvm.foo.a3` cannot share prefix `llvm.foo.a3` with another overloaded intrinsic `llvm.foo` // CHECK-CONFLICT: error: intrinsic `llvm.foo.bf16` cannot share prefix `llvm.foo.bf16` with another overloaded intrinsic `llvm.foo` diff --git a/llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp b/llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp index 18e0b8fd135bb..0846f66ea6452 100644 --- a/llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp +++ b/llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp @@ -157,7 +157,8 @@ static bool doesSuffixLookLikeMangledType(StringRef Suffix) { return false; // [pi][0-9]+ - if (is_contained("pi", Suffix[0]) && all_of(Suffix.drop_front(), isDigit)) + if (Suffix.size() > 1 && is_contained("pi", Suffix[0]) && + all_of(Suffix.drop_front(), isDigit)) return true; // Match one of the named types.