[PATCH] D20774: [InstCombine] look through bitcasts to find selects
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 13:09:02 PDT 2016
eli.friedman added a subscriber: eli.friedman.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1335
@@ +1334,3 @@
+
+ // Canonicalize SExt, Not, or BitCast to the LHS.
+ if (match(Op1, m_SExt(m_Value())) || match(Op1, m_Not(m_Value())) ||
----------------
This canonicalization seems incomplete... for example, if both operands are sext instructions, the one which belongs on the LHS is the one where the source is a bool, but this just picks randomly.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1359
@@ +1358,3 @@
+ // so the types all line up. We're assuming that bitcasts are free and, as
+ // above, a select is cheaper than the combination of sext + and.
+ //
----------------
Assuming bitcasts are free is kind of a big assumption... you could easily end up in situations where the bitcasts are not free. If X is scalar, the extra bitcasts should be folded away, but you could end up with bad effects on code like "((uint64_t)(vec1 == vec2)) & x".
http://reviews.llvm.org/D20774
More information about the llvm-commits
mailing list