[llvm] r335751 - [AliasSet] Fix UnknownInstructions printing

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 09:34:30 PDT 2018


Author: kuhar
Date: Wed Jun 27 09:34:30 2018
New Revision: 335751

URL: http://llvm.org/viewvc/llvm-project?rev=335751&view=rev
Log:
[AliasSet] Fix UnknownInstructions printing

Summary:
AliasSet::print uses `I->printAsOperand` to print UnknownInstructions. The problem is that not all UnknownInstructions have names (e.g. call instructions). When such instructions are printed, they appear as `<badref>` in AliasSets, which is very confusing, as the values are perfectly valid.

This patch fixes that by printing UnknownInstructions without a name using `print` instead of `printAsOperand`.

Reviewers: asbirlea, chandlerc, sanjoy, grosser

Reviewed By: asbirlea

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D48609

Modified:
    llvm/trunk/lib/Analysis/AliasSetTracker.cpp

Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=335751&r1=335750&r2=335751&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Wed Jun 27 09:34:30 2018
@@ -639,8 +639,12 @@ void AliasSet::print(raw_ostream &OS) co
     OS << "\n    " << UnknownInsts.size() << " Unknown instructions: ";
     for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) {
       if (i) OS << ", ";
-      if (auto *I = getUnknownInst(i))
-        I->printAsOperand(OS);
+      if (auto *I = getUnknownInst(i)) {
+        if (I->hasName())
+          I->printAsOperand(OS);
+        else
+          I->print(OS);
+      }
     }
   }
   OS << "\n";




More information about the llvm-commits mailing list