[PATCH] D22947: [CFLAA] Check for pointer type when adding landingpad and vaarg instructions to CFLGraph

Jia Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 16:26:34 PDT 2016


grievejia created this revision.
grievejia added reviewers: george.burgess.iv, hfinkel.
grievejia added a subscriber: llvm-commits.

CFLGraphBuilder::addNode() contains an assertion that will fail if the added node is not of pointer type. This may happen for landingpad instruction. I'm not sure if va_arg instruction could also have non-pointer type. To be safe I added a check there as well.

https://reviews.llvm.org/D22947

Files:
  lib/Analysis/CFLGraph.h

Index: lib/Analysis/CFLGraph.h
===================================================================
--- lib/Analysis/CFLGraph.h
+++ lib/Analysis/CFLGraph.h
@@ -334,7 +334,8 @@
       // For now, we'll handle this like a landingpad instruction (by placing
       // the
       // result in its own group, and having that group alias externals).
-      addNode(&Inst, getAttrUnknown());
+      if (Inst.getType()->isPointerTy())
+        addNode(&Inst, getAttrUnknown());
     }
 
     static bool isFunctionExternal(Function *Fn) {
@@ -457,7 +458,8 @@
       // Exceptions come from "nowhere", from our analysis' perspective.
       // So we place the instruction its own group, noting that said group may
       // alias externals
-      addNode(&Inst, getAttrUnknown());
+      if (Inst.getType()->isPointerTy())
+        addNode(&Inst, getAttrUnknown());
     }
 
     void visitInsertValueInst(InsertValueInst &Inst) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22947.66052.patch
Type: text/x-patch
Size: 921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/52cff481/attachment.bin>


More information about the llvm-commits mailing list