[all-commits] [llvm/llvm-project] 6a77e3: [SDAG] adjust isNegatibleForFree calculation to av...

RotateRight via All-commits all-commits at lists.llvm.org
Tue Dec 17 10:51:32 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a77e369755e59b92ac5b689a010bd0796810e35
      https://github.com/llvm/llvm-project/commit/6a77e369755e59b92ac5b689a010bd0796810e35
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2019-12-17 (Tue, 17 Dec 2019)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/AArch64/arm64-fmadd.ll
    M llvm/test/CodeGen/X86/fma-fneg-combine-2.ll

  Log Message:
  -----------
  [SDAG] adjust isNegatibleForFree calculation to avoid crashing

This is an alternate fix for the bug discussed in D70595.
This also includes minimal tests for other in-tree targets to show the problem more
generally.

We check the number of uses as a predicate for whether some value is free to negate,
but that use count can change as we rewrite the expression in getNegatedExpression().
So something that was marked free to negate during the cost evaluation phase becomes
not free to negate during the rewrite phase (or the inverse - something that was not
free becomes free). This can lead to a crash/assert because we expect that everything
in an expression that is negatible to be handled in the corresponding code within
getNegatedExpression().

This patch adds a hack to work-around the case where we probably no longer detect
that either multiply operand of an FMA isNegatibleForFree which is assumed to be
true when we started rewriting the expression.

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




More information about the All-commits mailing list