[llvm-commits] [llvm] r154324 - in /llvm/trunk: include/llvm/Instructions.h lib/Target/MBlaze/MBlazeELFWriterInfo.cpp

David Blaikie dblaikie at gmail.com
Mon Apr 9 09:29:36 PDT 2012


Author: dblaikie
Date: Mon Apr  9 11:29:35 2012
New Revision: 154324

URL: http://llvm.org/viewvc/llvm-project?rev=154324&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=154324&r1=154323&r2=154324&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Apr  9 11:29:35 2012
@@ -2507,7 +2507,8 @@
     
     /// 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());      
     }

Modified: llvm/trunk/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp?rev=154324&r1=154323&r2=154324&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp Mon Apr  9 11:29:35 2012
@@ -100,8 +100,8 @@
 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);
 }





More information about the llvm-commits mailing list