[all-commits] [llvm/llvm-project] 0a8e7c: [SLP] fix miscompile on min/max reductions with ex...

RotateRight via All-commits all-commits at lists.llvm.org
Tue Nov 19 11:58:38 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a8e7ca402eb3470eb5faf4982581771cb849130
      https://github.com/llvm/llvm-project/commit/0a8e7ca402eb3470eb5faf4982581771cb849130
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2019-11-19 (Tue, 19 Nov 2019)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/X86/reduction.ll
    M llvm/test/Transforms/SLPVectorizer/X86/used-reduced-op.ll

  Log Message:
  -----------
  [SLP] fix miscompile on min/max reductions with extra uses (PR43948) (2nd try)

The 1st attempt was reverted because it revealed an existing
bug where we could produce invalid IR (use of value before
definition). That should be fixed with:
rG39de82ecc9c2

The bug manifests as replacing a reduction operand with an undef
value.

The problem appears to be limited to cases where a min/max reduction
has extra uses of the compare operand to the select.

In the general case, we are tracking "ExternallyUsedValues" and
an "IgnoreList" of the reduction operations, but those may not apply
to the final compare+select in a min/max reduction.

For that, we use replaceAllUsesWith (RAUW) to ensure that the new
vectorized reduction values are transferred to all subsequent users.

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




More information about the All-commits mailing list