[llvm-commits] [llvm] r148284 - in /llvm/trunk: lib/Support/Host.cpp lib/Transforms/Scalar/ObjCARC.cpp lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/CmpInstAnalysis.cpp lib/VMCore/ConstantsContext.h lib/VMCore/Core.cpp lib/VMCore/Instruction.cpp tools/llvm-mc/llvm-mc.cpp tools/llvm-rtdyld/llvm-rtdyld.cpp utils/TableGen/CodeGenDAGPatterns.cpp utils/TableGen/X86DisassemblerTables.cpp

David Blaikie dblaikie at gmail.com
Mon Jan 16 20:43:57 PST 2012


Author: dblaikie
Date: Mon Jan 16 22:43:56 2012
New Revision: 148284

URL: http://llvm.org/viewvc/llvm-project?rev=148284&view=rev
Log:
Remove unreachable code. (replace with llvm_unreachable to help GCC where necessary)

Modified:
    llvm/trunk/lib/Support/Host.cpp
    llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
    llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
    llvm/trunk/lib/Transforms/Utils/CmpInstAnalysis.cpp
    llvm/trunk/lib/VMCore/ConstantsContext.h
    llvm/trunk/lib/VMCore/Core.cpp
    llvm/trunk/lib/VMCore/Instruction.cpp
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp
    llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
    llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp

Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Mon Jan 16 22:43:56 2012
@@ -61,6 +61,8 @@
     *rECX = registers[2];
     *rEDX = registers[3];
     return false;
+  #else
+    return true;
   #endif
 #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
   #if defined(__GNUC__)
@@ -87,9 +89,14 @@
       mov   dword ptr [esi],edx
     }
     return false;
+// pedantic #else returns to appease -Wunreachable-code (so we don't generate
+// postprocessed code that looks like "return true; return false;")
+  #else
+    return true;
   #endif
-#endif
+#else
   return true;
+#endif
 }
 
 static void DetectX86FamilyModel(unsigned EAX, unsigned &Family,

Modified: llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ObjCARC.cpp Mon Jan 16 22:43:56 2012
@@ -1886,7 +1886,6 @@
   }
 
   llvm_unreachable("Invalid dependence flavor");
-  return true;
 }
 
 /// FindDependencies - Walk up the CFG from StartPos (which is in StartBB) and

Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Jan 16 22:43:56 2012
@@ -249,7 +249,6 @@
     if (Term->getSuccessor(i) == Succ)
       return i;
   }
-  return 0;
 }
 
 /// SplitEdge -  Split the edge connecting specified block. Pass P must 

Modified: llvm/trunk/lib/Transforms/Utils/CmpInstAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CmpInstAnalysis.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CmpInstAnalysis.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CmpInstAnalysis.cpp Mon Jan 16 22:43:56 2012
@@ -59,7 +59,6 @@
       // True -> 7
     default:
       llvm_unreachable("Invalid ICmp predicate!");
-      return 0;
   }
 }
 

Modified: llvm/trunk/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantsContext.h?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantsContext.h (original)
+++ llvm/trunk/lib/VMCore/ConstantsContext.h Mon Jan 16 22:43:56 2012
@@ -458,7 +458,6 @@
       return new CompareConstantExpr(Ty, Instruction::FCmp, V.subclassdata,
                                      V.operands[0], V.operands[1]);
     llvm_unreachable("Invalid ConstantExpr!");
-    return 0;
   }
 };
 

Modified: llvm/trunk/lib/VMCore/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Core.cpp (original)
+++ llvm/trunk/lib/VMCore/Core.cpp Mon Jan 16 22:43:56 2012
@@ -1092,8 +1092,7 @@
     return LLVMCommonLinkage;
   }
 
-  // Should never get here.
-  return static_cast<LLVMLinkage>(0);
+  llvm_unreachable("Make GCC's unreachability happy");
 }
 
 void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage) {

Modified: llvm/trunk/lib/VMCore/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instruction.cpp (original)
+++ llvm/trunk/lib/VMCore/Instruction.cpp Mon Jan 16 22:43:56 2012
@@ -166,8 +166,6 @@
 
   default: return "<Invalid operator> ";
   }
-
-  return 0;
 }
 
 /// isIdenticalTo - Return true if the specified instruction is exactly

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Mon Jan 16 22:43:56 2012
@@ -526,6 +526,4 @@
   case AC_EDisassemble:
     return DisassembleInput(argv[0], true);
   }
-
-  return 0;
 }

Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Mon Jan 16 22:43:56 2012
@@ -163,6 +163,4 @@
   case AC_Execute:
     return executeInput();
   }
-
-  return 0;
 }

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Mon Jan 16 22:43:56 2012
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <set>
 #include <algorithm>
 using namespace llvm;
@@ -912,7 +913,7 @@
       EnforceVectorSubVectorTypeIs(NodeToApply->getExtType(ResNo), TP);
   }
   }
-  return false;
+  llvm_unreachable("Make GCC's unreachability happy");
 }
 
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp?rev=148284&r1=148283&r2=148284&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp (original)
+++ llvm/trunk/utils/TableGen/X86DisassemblerTables.cpp Mon Jan 16 22:43:56 2012
@@ -102,7 +102,6 @@
     return false;
   default:
     llvm_unreachable("Unknown instruction class");
-    return false;
   }
 }
 





More information about the llvm-commits mailing list