]> granicus.if.org Git - llvm/commitdiff
[GISel]:Skip legalizing Intermediate inst(with generic types)
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Thu, 4 May 2017 22:00:42 +0000 (22:00 +0000)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Thu, 4 May 2017 22:00:42 +0000 (22:00 +0000)
During legalization, targets can create Pseudo Instructions with
generic types. We shouldn't try to legalize them.

Reviewed by Quentin, dsanders
https://reviews.llvm.org/D32575

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302199 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalISel/Legalizer.cpp

index 74ed58e8d0493f05963ebc83c94da127ab327a7a..aec379197dfb77c8fdebbe0cfdefb3464d852237 100644 (file)
@@ -176,8 +176,13 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
       unsigned NumNewInsns = 0;
       SmallVector<MachineInstr *, 4> WorkList;
       Helper.MIRBuilder.recordInsertions([&](MachineInstr *MI) {
-        ++NumNewInsns;
-        WorkList.push_back(MI);
+        // Only legalize pre-isel generic instructions.
+        // Legalization process could generate Target specific pseudo
+        // instructions with generic types. Don't record them
+        if (isPreISelGenericOpcode(MI->getOpcode())) {
+          ++NumNewInsns;
+          WorkList.push_back(MI);
+        }
       });
       WorkList.push_back(&*MI);