Do not emit bit tests if target does not support natively left shift
authorAnton Korobeynikov <asl@math.spbu.ru>
Fri, 8 May 2009 18:51:34 +0000 (18:51 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Fri, 8 May 2009 18:51:34 +0000 (18:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index fd89108392cebaa3182a1cf573a2ead2d02d3b22..d0fd6b4f64c033c1521d3f6f60c9658032f5eb8e 100644 (file)
@@ -1923,6 +1923,10 @@ bool SelectionDAGLowering::handleBitTestsSwitchCase(CaseRec& CR,
   // inserting any additional MBBs necessary to represent the switch.
   MachineFunction *CurMF = CurMBB->getParent();
 
+  // If target does not have legal shift left, do not emit bit tests at all.
+  if (!TLI.isOperationLegal(ISD::SHL, TLI.getPointerTy()))
+    return false;
+
   size_t numCmps = 0;
   for (CaseItr I = CR.Range.first, E = CR.Range.second;
        I!=E; ++I) {