[PATCH] D47163: [InstCombine] don't change the size of a select if it would mismatch its condition operands' sizes

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 14:39:40 PDT 2018


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

Looks sane to me, but please do wait for someone else to review this too.



================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:289-290
+    // if the select does not have a compare instruction with matching operand
+    // types. Creating a select with operands that are different sizes than its
+    // condition may inhibit other folds and lead to worse codegen.
+    auto *Cmp = dyn_cast<CmpInst>(Sel->getCondition());
----------------
Hm, indeed.
https://godbolt.org/g/9zMbm8


https://reviews.llvm.org/D47163





More information about the llvm-commits mailing list