aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-04-09 16:29:35 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-04-09 16:29:35 +0000
commit6bb5212b6e0ed2607f08217df7468cc4492f3197 (patch)
tree236198af57690035134ce146e9228f98b83949e6
parentdecbc43f72866fa33d18e4b63d0d2dd2a2e102f6 (diff)
downloadexternal_llvm-6bb5212b6e0ed2607f08217df7468cc4492f3197.zip
external_llvm-6bb5212b6e0ed2607f08217df7468cc4492f3197.tar.gz
external_llvm-6bb5212b6e0ed2607f08217df7468cc4492f3197.tar.bz2
Fix accidentally constant conditions found by uncommitted improvements to -Wconstant-conversion.
A couple of cases where we were accidentally creating constant conditions by something like "x == a || b" instead of "x == a || x == b". In one case a conditional & then unreachable was used - I transformed this into a direct assert instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154324 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Instructions.h3
-rw-r--r--lib/Target/MBlaze/MBlazeELFWriterInfo.cpp8
2 files changed, 6 insertions, 5 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index e3676fe..f6eaf04 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -2507,7 +2507,8 @@ public:
/// Resolves successor for current case.
BasicBlockTy *getCaseSuccessor() {
- assert((Index < SI->getNumCases() || DefaultPseudoIndex) &&
+ assert((Index < SI->getNumCases() ||
+ Index == DefaultPseudoIndex) &&
"Index out the number of cases.");
return SI->getSuccessor(getSuccessorIndex());
}
diff --git a/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp b/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
index 60a65bb..e3c7236 100644
--- a/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
+++ b/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
@@ -100,8 +100,8 @@ unsigned MBlazeELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
long int MBlazeELFWriterInfo::computeRelocation(unsigned SymOffset,
unsigned RelOffset,
unsigned RelTy) const {
- if (RelTy == ELF::R_MICROBLAZE_32_PCREL || ELF::R_MICROBLAZE_64_PCREL)
- return SymOffset - (RelOffset + 4);
-
- llvm_unreachable("computeRelocation unknown for this relocation type");
+ assert((RelTy == ELF::R_MICROBLAZE_32_PCREL ||
+ RelTy == ELF::R_MICROBLAZE_64_PCREL) &&
+ "computeRelocation unknown for this relocation type");
+ return SymOffset - (RelOffset + 4);
}