efriedma added a comment. You want to avoid repeating all the code in AArch64TargetLowering::LowerBUILD_VECTOR which already exists for matching constants... so you probably need to fix it in LowerBUILD_VECTOR. Repository: rL LLVM https://reviews.llvm.org/D42133