[PATCH] D52232: [IPSCCP] Fix a problem with removing labels in a switch with undef condition

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 03:23:09 PDT 2018


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1891
 
+/// Update the condition for terminators that are branching on indeterminate
+/// values, forcing them to use a specific edge.
----------------
This is an internal function, not sure if we need a doxygen comment here.


================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1895
+  BasicBlock *Dest = nullptr;
+  Constant *C = nullptr;;
+  if (SwitchInst *SI = dyn_cast<SwitchInst>(I)) {
----------------
one ; too much


================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1924
+  }
+  return;
+}
----------------
no need for explicit return here.


================
Comment at: test/Transforms/SCCP/switch-undef-constantfoldterminator.ll:8
+;    Use still stuck around after Def is destroyed:  br i1 undef, label %lor.rhs, label %land.end
+;    opt: ../lib/IR/Value.cpp:92: llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
+;
----------------
I would drop the reference to the line number in Value.cpp, as it is subject to change.


Repository:
  rL LLVM

https://reviews.llvm.org/D52232





More information about the llvm-commits mailing list