[PATCH] D32641: [EarlyCSE] Teach EarlyCSE to work with non-instruction values

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 09:15:34 PDT 2017


dberlin added inline comments.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:101
+  Instruction *Inst = dyn_cast<Instruction>(Val.Val);
+  // Non-instruction values do not have operands.
+  if (!Inst)
----------------
This is not correct.
Example: ConstantExpr



================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:157
+
+  // For non-instruction values, we just compare references.
+  if (!LHSI || !RHSI)
----------------
FWIW: It's  possible for a constantexpr to be equivalent to an expression. 
This is not likely to happen that often, but.


https://reviews.llvm.org/D32641





More information about the llvm-commits mailing list