[PATCH] D79537: Add NoMerge MIFlag to avoid MIR branch folding

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 13:03:55 PDT 2020


rnk added a comment.

Overall, this looks good to me, but I'd like to ask @craig.topper for an opinion. His area of expertise is the x86 backend.



================
Comment at: llvm/include/llvm/CodeGen/SelectionDAG.h:1916
+  void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
+    SDCallSiteDbgInfo[Node].NoMerge = NoMerge;
+  }
----------------
If `NoMerge` is false, you can skip this hash table insertion. Otherwise, we will do this hash insertion for each and ever call instruction, but we only need to do it for this feature.


================
Comment at: llvm/include/llvm/CodeGen/SelectionDAG.h:281
     MDNode *HeapAllocSite = nullptr;
+    bool NoMerge;
   };
----------------
Please zero initialize this, otherwise the default constructor will not initialize it, and if entries in this hash table are added for other reasons, it will be uninitialized. You could observe this by combining the nomerge attribute with `__declspec(allocator)`, but IMO a test is not necessary.


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

https://reviews.llvm.org/D79537





More information about the llvm-commits mailing list