[PATCH] D55643: [llvm] Address base discriminator overflow in X86DiscriminateMemOps

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 11:44:27 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL349075: [llvm] Address base discriminator overflow in X86DiscriminateMemOps (authored by mtrofin, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55643/new/

https://reviews.llvm.org/D55643

Files:
  llvm/trunk/lib/Target/X86/X86DiscriminateMemOps.cpp


Index: llvm/trunk/lib/Target/X86/X86DiscriminateMemOps.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86DiscriminateMemOps.cpp
+++ llvm/trunk/lib/Target/X86/X86DiscriminateMemOps.cpp
@@ -24,6 +24,8 @@
 #include "llvm/Transforms/IPO/SampleProfile.h"
 using namespace llvm;
 
+#define DEBUG_TYPE "x86-discriminate-memops"
+
 namespace {
 
 using Location = std::pair<StringRef, unsigned>;
@@ -114,9 +116,18 @@
         Changed = true;
         const std::pair<DenseSet<unsigned>::iterator, bool> MustInsert =
             Set.insert(DI->getBaseDiscriminator());
-        (void)MustInsert; // silence warning.
-        assert(MustInsert.second &&
-               "New discriminator shouldn't be present in set");
+        // FIXME (mtrofin): check if the to-be inserted base discriminator can
+        // be added. This requires a new API on DILocation.
+        // The assumption is that this scenario is infrequent/OK not to support.
+        // If evidence points otherwise, we can explore synthesize unique DIs by
+        // adding fake line numbers.
+        if (!MustInsert.second) {
+          LLVM_DEBUG(dbgs()
+                     << "Unable to create a unique discriminator in "
+                     << DI->getFilename() << " Line: " << DI->getLine()
+                     << " Column: " << DI->getColumn()
+                     << ". This is likely due to a large macro expansion.\n");
+        }
       }
 
       // Bump the reference DI to avoid cramming discriminators on line 0.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55643.178105.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181213/64a641c3/attachment.bin>


More information about the llvm-commits mailing list