[llvm] [InstCombine] Bail out on type mismatch in foldBitCastBitwiseLogic (PR #179640)

Kacper Doga via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 03:43:53 PST 2026


varev-dev wrote:

Update regarding the fix approach: Following the feedback and further debugging I confirmed that the root cause lies in `lib/Analysis/ConstantFolding.cpp`, The function FoldBitCast incorrectly calculates the element ratio for vector types that don't divide evenly (e.g., casting 3 x i32 to 4 x i24), leading to a result with the wrong number of elements.

I am rewriting this patch to fix `ConstantFolding.cpp` directly. I will implement a check to handle these non-uniform vector bitcasts correctly.

https://github.com/llvm/llvm-project/pull/179640


More information about the llvm-commits mailing list