[all-commits] [llvm/llvm-project] d168b7: [DAGCombiner] Fix non-determinism problem related ...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Fri Mar 20 08:19:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d168b7778035af6cc795b2367ca7f379ce1a629e
      https://github.com/llvm/llvm-project/commit/d168b7778035af6cc795b2367ca7f379ce1a629e
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2020-03-20 (Fri, 20 Mar 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/X86/fdiv.ll

  Log Message:
  -----------
  [DAGCombiner] Fix non-determinism problem related to argument evaluation order in visitFDIV

Summary:
For some reason the order in which we call getNegatedExpression
for the involved operands, after a call to isCheaperToUseNegatedFPOps,
seem to matter. This patch includes a new test case in
test/CodeGen/X86/fdiv.ll that crashes if we reverse the order of
those calls. Before this patch that could happen depending on
which compiler that were used when buildind llvm. With my GCC
version (7.4.0) I got the crash, because it seems like it is
using a different order for the argument evaluation compared
to clang.

All other users of isCheaperToUseNegatedFPOps already used this
pattern with unfolded/ordered calls to getNegatedExpression, so
this patch is aligning visitFDIV with the other use cases.

This patch simply deals with the non-determinism for FDIV. While
the underlying problem with getNegatedExpression is discussed
further in D76439.

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list