[PATCH] D32575: Don't try to legalize Intermediate instructions (with generic types)

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 17:32:40 PDT 2017


aditya_nandakumar created this revision.

During legalization, targets can create Pseudo Instructions with generic types. We shouldn't try to legalize them.


Repository:
  rL LLVM

https://reviews.llvm.org/D32575

Files:
  lib/CodeGen/GlobalISel/Legalizer.cpp


Index: lib/CodeGen/GlobalISel/Legalizer.cpp
===================================================================
--- lib/CodeGen/GlobalISel/Legalizer.cpp
+++ lib/CodeGen/GlobalISel/Legalizer.cpp
@@ -185,7 +185,13 @@
       LegalizerHelper::LegalizeResult Res;
       unsigned Idx = 0;
       do {
-        Res = Helper.legalizeInstrStep(*WorkList[Idx]);
+        // Only legalize pre-isel generic instructions.
+        // Legalization process could generate Target specific pseudo
+        // instructions with generic types. Don't legalize them
+        if (!isPreISelGenericOpcode(WorkList[Idx]->getOpcode()))
+          Res = LegalizerHelper::AlreadyLegal;
+        else
+          Res = Helper.legalizeInstrStep(*WorkList[Idx]);
         // Error out if we couldn't legalize this instruction. We may want to
         // fall back to DAG ISel instead in the future.
         if (Res == LegalizerHelper::UnableToLegalize) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32575.96854.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170427/1084dadb/attachment.bin>


More information about the llvm-commits mailing list