OSDN Git Service

[RegisterBankInfo] Ignore InstrMappings that create impossible to repair operands
authorTom Stellard <tstellar@redhat.com>
Wed, 25 Jul 2018 03:08:35 +0000 (03:08 +0000)
committerTom Stellard <tstellar@redhat.com>
Wed, 25 Jul 2018 03:08:35 +0000 (03:08 +0000)
Summary:
This is a follow-up to r303043.  In computeMapping(), we need to disqualify an
InstrMapping if it would be impossible to repair one of the registers in the
instruction to match the mapping.

This change is needed in order to be able to define an instruction
mapping for G_SELECT for the AMDGPU target and will be tested
by test/CodeGen/AMDGPU/GlobalISel/regbankselect-select.mir

Reviewers: ab, qcolombet, t.p.northover, dsanders

Reviewed By: qcolombet

Subscribers: tpr, llvm-commits

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

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

lib/CodeGen/GlobalISel/RegBankSelect.cpp

index 79fa888..9e2d48d 100644 (file)
@@ -475,7 +475,7 @@ RegBankSelect::MappingCost RegBankSelect::computeMapping(
 
     // This is an impossible to repair cost.
     if (RepairCost == std::numeric_limits<unsigned>::max())
-      continue;
+      return MappingCost::ImpossibleCost();
 
     // Bias used for splitting: 5%.
     const uint64_t PercentageForBias = 5;