[llvm] r307486 - [InstCombine] Speculatively implement a fix for what might be the root cause of PR33721 by making sure that we have integer types before doing select C, -1, 0 -> sext C to int
Yung, Douglas via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 19:43:51 PDT 2017
Hi Craig, could you please add a regression test for this change? Russell included a reduced test case in comment 4 (https://bugs.llvm.org/show_bug.cgi?id=33721#c4) which would make a good starting point.
Thanks!
Douglas Yung
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf Of
> Craig Topper via llvm-commits
> Sent: Saturday, July 08, 2017 20:25
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r307486 - [InstCombine] Speculatively implement a fix for what
> might be the root cause of PR33721 by making sure that we have integer types
> before doing select C, -1, 0 -> sext C to int
>
> Author: ctopper
> Date: Sat Jul 8 20:25:17 2017
> New Revision: 307486
>
> URL: http://llvm.org/viewvc/llvm-project?rev=307486&view=rev
> Log:
> [InstCombine] Speculatively implement a fix for what might be the root cause
> of PR33721 by making sure that we have integer types before doing select C, -
> 1, 0 -> sext C to int
>
> I recently changed m_One and m_AllOnes to use
> Constant::isOneValue/isAllOnesValue which work on floating point values too.
> The original implementation looked specifically for ConstantInt scalars and
> splats. So I'm guessing we are accidentally trying to issue sext/zexts on
> floating point types now.
>
> Hopefully I figure out how to reproduce the failure from the PR soon.
>
> Modified:
> llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp?rev=307486
> &r1=307485&r2=307486&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp Sat Jul 8
> 20:25:17 2017
> @@ -1223,7 +1223,8 @@ Instruction *InstCombiner::visitSelectIn
> // select i1 %c, <2 x i8> <1, 1>, <2 x i8> <0, 0>
> // because that may need 3 instructions to splat the condition value:
> // extend, insertelement, shufflevector.
> - if (CondVal->getType()->isVectorTy() == SelType->isVectorTy()) {
> + if (SelType->isIntOrIntVectorTy() &&
> + CondVal->getType()->isVectorTy() == SelType->isVectorTy()) {
> // select C, 1, 0 -> zext C to int
> if (match(TrueVal, m_One()) && match(FalseVal, m_Zero()))
> return new ZExtInst(CondVal, SelType);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list