[llvm] r298640 - [LVIPrinterPass] Print LVI info for function arguments

Anna Thomas via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 13:00:54 PDT 2017


Author: annat
Date: Thu Mar 23 15:00:54 2017
New Revision: 298640

URL: http://llvm.org/viewvc/llvm-project?rev=298640&view=rev
Log:
[LVIPrinterPass] Print LVI info for function arguments

Using AssemblyAnnotationWriter for LVI printer prints
for instructions and basic blocks.
So, we explicitly need to print LVI info for the arguments of the function (these
are values and not instructions).

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

Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=298640&r1=298639&r2=298640&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Thu Mar 23 15:00:54 2017
@@ -486,6 +486,18 @@ namespace {
       OS << "; OverDefined values for block are: \n";
       for (auto *V : ODI->second)
         OS << ";" << *V << "\n";
+
+      // Find if there are latticevalues defined for arguments of the function.
+      auto *F = const_cast<Function *>(BB->getParent());
+      for (auto &Arg : F->args()) {
+        auto VI = LVICache->ValueCache.find_as(&Arg);
+        if (VI == LVICache->ValueCache.end())
+          continue;
+        auto BBI = VI->second->BlockVals.find(const_cast<BasicBlock *>(BB));
+        if (BBI != VI->second->BlockVals.end())
+          OS << "; CachedLatticeValue for: '" << *VI->first << "' is: '"
+             << BBI->second << "'\n";
+      }
     }
 
     virtual void emitInstructionAnnot(const Instruction *I,




More information about the llvm-commits mailing list