[llvm] r344610 - [InstCombine] make sure type is integer before calling ComputeNumSignBits

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 11:20:28 PDT 2018


On 10/16/2018 7:44 AM, Sanjay Patel via llvm-commits wrote:
> Author: spatel
> Date: Tue Oct 16 07:44:50 2018
> New Revision: 344610
>
> URL: http://llvm.org/viewvc/llvm-project?rev=344610&view=rev
> Log:
> [InstCombine] make sure type is integer before calling ComputeNumSignBits
>
> Modified:
>      llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=344610&r1=344609&r2=344610&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Tue Oct 16 07:44:50 2018
> @@ -1834,7 +1834,8 @@ static bool areInverseVectorBitmasks(Con
>   Value *InstCombiner::getSelectCondition(Value *A, Value *B) {
>     // Step 1: We need 0 or all-1's bitmasks.
>     Type *Ty = A->getType();
> -  if (ComputeNumSignBits(A) != Ty->getScalarSizeInBits())
> +  if (Ty->isIntOrIntVectorTy() &&
> +      ComputeNumSignBits(A) != Ty->getScalarSizeInBits())

"&&"?  Don't we need to exit early if the type isn't an integer type?

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list