Fix accidentally constant conditions found by uncommitted improvements to -Wconstant...
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Apr 2012 16:29:35 +0000 (16:29 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Apr 2012 16:29:35 +0000 (16:29 +0000)
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

include/llvm/Instructions.h
lib/Target/MBlaze/MBlazeELFWriterInfo.cpp

index e3676fe919fa7457c76d6c29986ae3c90dd6865b..f6eaf04fd0d94150e2893b6f8c86f5d16c2aa34d 100644 (file)
@@ -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());      
     }
index 60a65bbb733438a9643bdb2e9aa1ee49d3602dca..e3c7236d1141e063f464e25737ea04785363f5f8 100644 (file)
@@ -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);
 }