[PATCH] D32586: [EarlyCSE] Prepare EarlyCSE to work with non-instruction values

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 11:57:36 PDT 2017


reames added a comment.

minor comments, once addressed looks likely ready to go.  I do want to see the fixed patch before submission.



================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:90
   static inline SimpleValue getEmptyKey() {
     return DenseMapInfo<Instruction *>::getEmptyKey();
   }
----------------
Don't these need to change as well?


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:102
+  assert(isa<Instruction>(Val.Val) && "Is not an instruction!");
+  Instruction *Inst = cast<Instruction>(Val.Val);
   // Hash in all of the operands as pointers.
----------------
cast is a checked cast.  The previous assert is unnecessary.  


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:152
+
+  assert(isa<Instruction>(LHS.Val) && "Can only work with instructions!");
+  assert(isa<Instruction>(RHS.Val) && "Can only work with instructions!");
----------------
Again, checked casts.


https://reviews.llvm.org/D32586





More information about the llvm-commits mailing list