[PATCH] D41296: Limit size of SROA - generated register names

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 08:35:41 PST 2017


hfinkel added a comment.

Why don't we just cap all names at some point (and then just start adding numbers as we generally do to break degeneracies). It seems like, otherwise, we'll end up with these kinds of fixes in many places. Fixing this in one common place seems better. I'd be much happier, for example, to see a change in lib/IR/Value.cpp where we have:

  void Value::setNameImpl(const Twine &NewName) {
    // Fast-path: LLVMContext can be set to strip out non-GlobalValue names
    if (getContext().shouldDiscardValueNames() && !isa<GlobalValue>(this))
      return;
  
    ...
  
    SmallString<256> NameData;
    StringRef NameRef = NewName.toStringRef(NameData);

to have something like:

  // Prevent names from becoming too long.
  if (!isa<GlobalValue>(this) && NameData.size() > MaxInternalName)
    NameData.resize(MaxInternalName);



================
Comment at: test/Transforms/SROA/register-name-too-long.ll:1
+; this etst case used to swap because of too many intermediate steps resulting in utterly long names
+; RUN: opt < %s -sroa -S
----------------
this etst -> This test


Repository:
  rL LLVM

https://reviews.llvm.org/D41296





More information about the llvm-commits mailing list