[PATCH] D113035: [InstCombine] enhance vector bitwise select matching

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 06:00:03 PST 2021


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2313
+    A = peekThroughBitcast(A);
+    unsigned NumSignBits = ComputeNumSignBits(A);
+    if (NumSignBits == A->getType()->getScalarSizeInBits() &&
----------------
yubing wrote:
> I think we should check if A is Integer vector after A = peekThroughBitcast(A);
> A might be  %astype = bitcast <4 x float> %c to <4 x i32>
> when you peek through A, A become <4 x float> %c which can't be handled with ComputeNumSignBits.
Yes - this can crash. Thanks for catching that! 
I'll add a test and update.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113035/new/

https://reviews.llvm.org/D113035



More information about the llvm-commits mailing list