[PATCH] D29180: Fix implementation of DAGTypeLegalizer::PerformExpensiveChecks

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 08:16:03 PST 2017


sepavloff created this revision.
Herald added a subscriber: wdng.

Implementation of DAGTypeLegalizer::PerformExpensiveChecks is out of sync
with the current algorithm of the type legalizer. In particular, it requests
that unprocessed nodes marked as `NewNode` must not be present in any of the
conversion maps except probably ReplacedValues. It is not true now, abandoned
nodes (they are also marked as `NewNode`) now may be found in the map
`SoftenedFloats` as well.

This change fixes several fails when expensive checks are enabled.


https://reviews.llvm.org/D29180

Files:
  lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
  test/CodeGen/ARM/fp16.ll


Index: test/CodeGen/ARM/fp16.ll
===================================================================
--- test/CodeGen/ARM/fp16.ll
+++ test/CodeGen/ARM/fp16.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mtriple=armv7a--none-gnueabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-HARDFLOAT-GNU %s
 ; RUN: llc -mtriple=armv7a--none-musleabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-HARDFLOAT-GNU %s
 ; RUN: llc -mtriple=armv8-eabihf < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-ARMV8 %s
-; RUN: llc -mtriple=thumbv7m-eabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-EABI %s
+; RUN: llc -mtriple=thumbv7m-eabi -enable-legalize-types-checking < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-EABI %s
 ; RUN: llc -mtriple=thumbv7m-gnueabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-GNU %s
 ; RUN: llc -mtriple=thumbv7m-musleabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-GNU %s
 
Index: lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -124,7 +124,9 @@
         // Since we allow ReplacedValues to map deleted nodes, it may map nodes
         // marked NewNode too, since a deleted node may have been reallocated as
         // another node that has not been seen by the LegalizeTypes machinery.
-        if ((Node.getNodeId() == NewNode && Mapped > 1) ||
+        // Treatment of SoftenedFloats may also create nodes that are abandoned
+        // latter.
+        if ((Node.getNodeId() == NewNode && Mapped > 1 && Mapped != 4) ||
             (Node.getNodeId() != NewNode && Mapped != 0)) {
           dbgs() << "Unprocessed value in a map!";
           Failed = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29180.85915.patch
Type: text/x-patch
Size: 1850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170126/047cc849/attachment.bin>


More information about the llvm-commits mailing list