[PATCH] D48609: [AliasSet] Fix UnknownInstructions printing

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 14:51:46 PDT 2018


kuhar created this revision.
kuhar added reviewers: asbirlea, chandlerc, sanjoy.
Herald added a reviewer: grosser.

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`.


Repository:
  rL LLVM

https://reviews.llvm.org/D48609

Files:
  lib/Analysis/AliasSetTracker.cpp


Index: lib/Analysis/AliasSetTracker.cpp
===================================================================
--- lib/Analysis/AliasSetTracker.cpp
+++ lib/Analysis/AliasSetTracker.cpp
@@ -639,8 +639,12 @@
     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";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48609.152966.patch
Type: text/x-patch
Size: 618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180626/a1d63e95/attachment.bin>


More information about the llvm-commits mailing list