[all-commits] [llvm/llvm-project] 714cee: [SelectionDAG] Always intersect SDNode flags durin...

Jonas Paulsson via All-commits all-commits at lists.llvm.org
Sat Sep 5 01:32:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 714ceefad9b96ab3ef20913f2110883a1ad34a13
      https://github.com/llvm/llvm-project/commit/714ceefad9b96ab3ef20913f2110883a1ad34a13
  Author: Jonas Paulsson <paulsson at linux.vnet.ibm.com>
  Date:   2020-09-05 (Sat, 05 Sep 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAGNodes.h
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
    A llvm/test/CodeGen/SystemZ/fp-mul-14.ll
    A llvm/test/CodeGen/SystemZ/int-cmp-60.ll

  Log Message:
  -----------
  [SelectionDAG] Always intersect SDNode flags during getNode() node memoization.

Previously SDNodeFlags::instersectWith(Flags) would do nothing if Flags was
in an undefined state, which is very bad given that this is the default when
getNode() is called without passing an explicit SDNodeFlags argument.

This meant that if an already existing and reused node had a flag which the
second caller to getNode() did not set, that flag would remain uncleared.

This was exposed by https://bugs.llvm.org/show_bug.cgi?id=47092, where an NSW
flag was incorrectly set on an add instruction (which did in fact overflow in
one of the two original contexts), so when SystemZElimCompare removed the
compare with 0 trusting that flag, wrong-code resulted.

There is more that needs to be done in this area as discussed here:

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

Review: Ulrich Weigand, Sanjay Patel




More information about the All-commits mailing list