Successfully identified regression in *llvm* in CI configuration tcwg_bmk_llvm_apm/llvm-master-aarch64-spec2k6-Os_LTO. So far, this commit has regressed CI configurations: - tcwg_bmk_llvm_apm/llvm-master-aarch64-spec2k6-Os_LTO
Culprit: <cut> commit 0a241e90d4931a764109da70c2322a0a9386b1a7 Author: Roman Lebedev lebedev.ri@gmail.com Date: Sat Aug 7 15:59:21 2021 +0300
[NFC][InstCombine] `vector_reduce_xor(?ext(<n x i1>))` --> `?ext(vector_reduce_add(<n x i1>))`
Instead of expanding it ourselves, we can just forward to `?ext(vector_reduce_add(<n x i1>))`, as per alive2: https://alive2.llvm.org/ce/z/ymz7zE (self) https://alive2.llvm.org/ce/z/eKu2v2 (skipped zext) https://alive2.llvm.org/ce/z/c3BXgc (skipped sext) </cut>
Results regressed to (for first_bad == 0a241e90d4931a764109da70c2322a0a9386b1a7) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -Os_LTO artifacts/build-0a241e90d4931a764109da70c2322a0a9386b1a7/results_id: 1 # 433.milc,milc_base.default regressed by 102 # 453.povray,povray_base.default regressed by 102 # 470.lbm,lbm_base.default regressed by 103
from (for last_good == c6ff867f92f67c6451ed1709f2af66211cb7b901) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -Os_LTO artifacts/build-c6ff867f92f67c6451ed1709f2af66211cb7b901/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... Results ID of last_good: apm_64/tcwg_bmk_llvm_apm/bisect-llvm-master-aarch64-spec2k6-Os_LTO/3523 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... Results ID of first_bad: apm_64/tcwg_bmk_llvm_apm/bisect-llvm-master-aarch64-spec2k6-Os_LTO/3530 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a...
Configuration details:
Reproduce builds: <cut> mkdir investigate-llvm-0a241e90d4931a764109da70c2322a0a9386b1a7 cd investigate-llvm-0a241e90d4931a764109da70c2322a0a9386b1a7
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /llvm/ ./ ./bisect/baseline/
cd llvm
# Reproduce first_bad build git checkout --detach 0a241e90d4931a764109da70c2322a0a9386b1a7 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach c6ff867f92f67c6451ed1709f2af66211cb7b901 ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-master-a...
Full commit (up to 1000 lines): <cut> commit 0a241e90d4931a764109da70c2322a0a9386b1a7 Author: Roman Lebedev lebedev.ri@gmail.com Date: Sat Aug 7 15:59:21 2021 +0300
[NFC][InstCombine] `vector_reduce_xor(?ext(<n x i1>))` --> `?ext(vector_reduce_add(<n x i1>))`
Instead of expanding it ourselves, we can just forward to `?ext(vector_reduce_add(<n x i1>))`, as per alive2: https://alive2.llvm.org/ce/z/ymz7zE (self) https://alive2.llvm.org/ce/z/eKu2v2 (skipped zext) https://alive2.llvm.org/ce/z/c3BXgc (skipped sext) --- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 2ba326d791c2..210652e23377 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2038,20 +2038,17 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) { if (IID == Intrinsic::vector_reduce_xor) { // Exclusive disjunction reduction over the vector with // (potentially-extended) i1 element type is actually a - // (potentially-extended) parity check: + // (potentially-extended) arithmetic `add` reduction over the original + // non-extended value: // vector_reduce_xor(?ext(<n x i1>)) // --> - // ?ext(trunc(vector_reduce_and(<n x i1>) to i1)) + // ?ext(vector_reduce_add(<n x i1>)) Value *Arg = II->getArgOperand(0); Value *Vect; if (match(Arg, m_ZExtOrSExtOrSelf(m_Value(Vect)))) { if (auto *FTy = dyn_cast<FixedVectorType>(Vect->getType())) if (FTy->getElementType() == Builder.getInt1Ty()) { - Value *V = Builder.CreateBitCast( - Vect, Builder.getIntNTy(FTy->getNumElements())); - Value *Res = Builder.CreateUnaryIntrinsic(Intrinsic::ctpop, V); - Res = Builder.CreateTrunc(Res, - IntegerType::get(Res->getContext(), 1)); + Value *Res = Builder.CreateAddReduce(Vect); if (Arg != Vect) Res = Builder.CreateCast(cast<CastInst>(Arg)->getOpcode(), Res, II->getType()); </cut>