[llvm] r349464 - GlobalISel: Improve crash on invalid mapping

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 01:27:29 PST 2018


Author: arsenm
Date: Tue Dec 18 01:27:29 2018
New Revision: 349464

URL: http://llvm.org/viewvc/llvm-project?rev=349464&view=rev
Log:
GlobalISel: Improve crash on invalid mapping

If NumBreakDowns is 0, BreakDown is null.
This trades a null dereference with an assert somewhere
else.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp?rev=349464&r1=349463&r2=349464&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp Tue Dec 18 01:27:29 2018
@@ -116,7 +116,7 @@ bool RegBankSelect::assignmentMatch(
   OnlyAssign = false;
   // Each part of a break down needs to end up in a different register.
   // In other word, Reg assignement does not match.
-  if (ValMapping.NumBreakDowns > 1)
+  if (ValMapping.NumBreakDowns != 1)
     return false;
 
   const RegisterBank *CurRegBank = RBI->getRegBank(Reg, *MRI, *TRI);




More information about the llvm-commits mailing list