[PATCH] D63349: [EarlyCSE] Fix hashing of self-compares

Joseph Tremoulet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 11:56:00 PDT 2019


JosephTremoulet marked an inline comment as done.
JosephTremoulet added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/EarlyCSE.cpp:185
+    CmpInst::Predicate SwappedPred = CI->getSwappedPredicate();
+    if (std::tie(LHS, Pred) > std::tie(RHS, SwappedPred)) {
       std::swap(LHS, RHS);
----------------
nikic wrote:
> Would it be possible to make the condition just `Pred > SwappedPred`, without ordering by LHS/RHS at all?
No, some predicates (eq, ne) are their own swap duals, so we need to check the operands to handle e.g. `icmp eq A, B` vs `icmp eq B, A`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63349/new/

https://reviews.llvm.org/D63349





More information about the llvm-commits mailing list