[all-commits] [llvm/llvm-project] d0746f: Don't fold (select C, (gep Ptr, Idx), Ptr) if C is...

Yi Kong via All-commits all-commits at lists.llvm.org
Wed Sep 22 03:11:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0746f2e9bbf08f52196ae12f25d0ef7edcbbe4c
      https://github.com/llvm/llvm-project/commit/d0746f2e9bbf08f52196ae12f25d0ef7edcbbe4c
  Author: Yi Kong <yikong at google.com>
  Date:   2021-09-22 (Wed, 22 Sep 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-gep.ll

  Log Message:
  -----------
  Don't fold (select C, (gep Ptr, Idx), Ptr) if C is vector but Idx is scalar

The folding rule (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C,
Idx, 0)) creates a malformed SELECT IR if C is a vector while Idx is scalar.

  SELECT VecC, ScalarIdx, 0

We could splat Idx to a vector but it defeats the purpose of
optimisation. Don't apply the folding rule in this case.

This fixes a regression from commit d561b6fbdbe6d1da05fd92003a4ac1e37bf4b8bc.




More information about the All-commits mailing list