[llvm-commits] [llvm] r156209 - /llvm/trunk/lib/Target/NVPTX/NVPTX.h
Chandler Carruth
chandlerc at gmail.com
Fri May 4 14:35:49 PDT 2012
Author: chandlerc
Date: Fri May 4 16:35:49 2012
New Revision: 156209
URL: http://llvm.org/viewvc/llvm-project?rev=156209&view=rev
Log:
Fix a Clang warning in the new NVPTX backend:
In file included from ../lib/Target/NVPTX/VectorElementize.cpp:53:
../lib/Target/NVPTX/NVPTX.h:44:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
default: assert(0 && "Unknown condition code");
^
1 warning generated.
The prevailing pattern in LLVM is to not use a default label, and instead to
use llvm_unreachable to denote that the switch in fact covers all return paths
from the function.
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTX.h
Modified: llvm/trunk/lib/Target/NVPTX/NVPTX.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTX.h?rev=156209&r1=156208&r2=156209&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTX.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTX.h Fri May 4 16:35:49 2012
@@ -41,7 +41,6 @@
inline static const char *NVPTXCondCodeToString(NVPTXCC::CondCodes CC) {
switch (CC) {
- default: assert(0 && "Unknown condition code");
case NVPTXCC::NE: return "ne";
case NVPTXCC::EQ: return "eq";
case NVPTXCC::LT: return "lt";
@@ -49,6 +48,7 @@
case NVPTXCC::GT: return "gt";
case NVPTXCC::GE: return "ge";
}
+ llvm_unreachable("Unknown condition code");
}
FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
More information about the llvm-commits
mailing list