[PATCH] D33186: [InstCombine] Canonicalize clamp of float types to minmax in fast mode.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 3 11:28:07 PDT 2017
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:1326
+ bool IsCastNeeded = LHS->getType()->getPrimitiveSizeInBits() !=
+ SelType->getPrimitiveSizeInBits();
+ Value *CmpLHS = cast<CmpInst>(CondVal)->getOperand(0);
----------------
This is very suspicious.
The way the implementation of matchSelectPattern is written, CastOp is uninitialized if the type of the compare matches the type of the select; otherwise, it's set to whatever cast we looked through. That cast might not be a cast which changes the size of the type; it could bit a BitCast/FPToUI/etc.
I'd like to see a few testcases which cover the situations where we insert casts.
https://reviews.llvm.org/D33186
More information about the llvm-commits
mailing list