diff options
author | Hasyimi Bahrudin <hasyimi@ridebeam.com> | 2021-05-27 04:01:20 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2021-05-27 04:20:03 +0000 |
commit | 8d25762720660aba3344752e577ae7017e6125c2 (patch) | |
tree | 4c8fb6c199e4ee22a94bcf93ebc87cc2726e81f6 /llvm/lib/IR/Value.cpp | |
parent | 0ce58c52d50bd2edd09df7c7ef3dd4dc85b05992 (diff) | |
download | llvm-8d25762720660aba3344752e577ae7017e6125c2.zip llvm-8d25762720660aba3344752e577ae7017e6125c2.tar.gz llvm-8d25762720660aba3344752e577ae7017e6125c2.tar.bz2 |
Fix non-global-value-max-name-size not considered by LLParser
`non-global-value-max-name-size` is used by `Value` to cap the length of local value name. However, this flag is not considered by `LLParser`, which leads to unexpected `use of undefined value error`. The fix is to move the responsibility of capping the length to `ValueSymbolTable`.
The test is the one provided by [[ https://bugs.llvm.org/show_bug.cgi?id=45899 | Mikael in the bug report ]].
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D102707
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index d5587b4..33b61c9 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -42,11 +42,6 @@ static cl::opt<unsigned> UseDerefAtPointSemantics( "use-dereferenceable-at-point-semantics", cl::Hidden, cl::init(false), cl::desc("Deref attributes and metadata infer facts at definition only")); - -static cl::opt<unsigned> NonGlobalValueMaxNameSize( - "non-global-value-max-name-size", cl::Hidden, cl::init(1024), - cl::desc("Maximum size for the name of non-global values.")); - //===----------------------------------------------------------------------===// // Value Class //===----------------------------------------------------------------------===// @@ -323,11 +318,6 @@ void Value::setNameImpl(const Twine &NewName) { if (getName() == NameRef) return; - // Cap the size of non-GlobalValue names. - if (NameRef.size() > NonGlobalValueMaxNameSize && !isa<GlobalValue>(this)) - NameRef = - NameRef.substr(0, std::max(1u, (unsigned)NonGlobalValueMaxNameSize)); - assert(!getType()->isVoidTy() && "Cannot assign a name to void values!"); // Get the symbol table to update for this object. |