[PATCH] D20957: [JumpThreading] Prevent dangling pointer problems in BranchProbabilityInfo

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 10:41:24 PDT 2016


davidxl added inline comments.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:238
@@ -237,1 +237,3 @@
         LVI->eraseBlock(BB);
+        if (HasProfileData)
+          BPI->eraseBlock(BB);
----------------
maybe just check nullness of BPI

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:268
@@ -265,1 +267,3 @@
         LVI->eraseBlock(BB);
+        if (HasProfileData)
+          BPI->eraseBlock(BB);
----------------
Same here.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:753
@@ -748,2 +752,3 @@
 
       LVI->eraseBlock(SinglePred);
+      if (HasProfileData)
----------------
This pattern repeats many times, it is better to create a small wrapper member function to erase BB.

================
Comment at: test/Transforms/JumpThreading/dangling-pointers-in-bpi.ll:1
@@ +1,2 @@
+; RUN: opt -S -jump-threading %s | FileCheck %s
+
----------------
What does this test do? THere is no check string?


http://reviews.llvm.org/D20957





More information about the llvm-commits mailing list