[all-commits] [llvm/llvm-project] 2c551a: [LoopVectorize] Fix bug where predicated loads/sto...

Joe Ellis via All-commits all-commits at lists.llvm.org
Thu Apr 22 08:06:38 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2c551aedcf8b15366cd32846f3e64078c01d9b18
      https://github.com/llvm/llvm-project/commit/2c551aedcf8b15366cd32846f3e64078c01d9b18
  Author: Joe Ellis <joe.ellis at arm.com>
  Date:   2021-04-22 (Thu, 22 Apr 2021)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    A llvm/test/Transforms/LoopVectorize/AArch64/scalarize-store-with-predication.ll
    M llvm/test/Transforms/LoopVectorize/X86/x86-predication.ll

  Log Message:
  -----------
  [LoopVectorize] Fix bug where predicated loads/stores were dropped

This commit fixes a bug where the loop vectoriser fails to predicate
loads/stores when interleaving for targets that support masked
loads and stores.

Code such as:

     1  void foo(int *restrict data1, int *restrict data2)
     2  {
     3    int counter = 1024;
     4    while (counter--)
     5      if (data1[counter] > data2[counter])
     6        data1[counter] = data2[counter];
     7  }

... could previously be transformed in such a way that the predicated
store implied by:

    if (data1[counter] > data2[counter])
       data1[counter] = data2[counter];

... was lost, resulting in miscompiles.

This bug was causing some tests in llvm-test-suite to fail when built
for SVE.

Differential Revision: https://reviews.llvm.org/D99569




More information about the All-commits mailing list