There was a switch fall-through in the parser for textual LLVM that caused
authorDavid Tweed <david.tweed@arm.com>
Mon, 7 Jan 2013 13:32:38 +0000 (13:32 +0000)
committerDavid Tweed <david.tweed@arm.com>
Mon, 7 Jan 2013 13:32:38 +0000 (13:32 +0000)
bogus comparison operands to default to eq/oeq. Fix that, fix a couple of
tests that accidentally passed and test for bogus comparison opeartors
explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171733 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/LLParser.cpp
test/Feature/const_pv.ll
test/Transforms/EarlyCSE/commute.ll
test/Transforms/LoopIdiom/X86/popcnt.ll

index 5d5ff81da7056c7d00c3ba1ccfe97c1fd1849ea6..fea5ec84f9daf36eff33cb5f0b797e6655a700de 100644 (file)
@@ -3120,7 +3120,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
 bool LLParser::ParseCmpPredicate(unsigned &P, unsigned Opc) {
   if (Opc == Instruction::FCmp) {
     switch (Lex.getKind()) {
-    default: TokError("expected fcmp predicate (e.g. 'oeq')");
+    default: return TokError("expected fcmp predicate (e.g. 'oeq')");
     case lltok::kw_oeq: P = CmpInst::FCMP_OEQ; break;
     case lltok::kw_one: P = CmpInst::FCMP_ONE; break;
     case lltok::kw_olt: P = CmpInst::FCMP_OLT; break;
@@ -3140,7 +3140,7 @@ bool LLParser::ParseCmpPredicate(unsigned &P, unsigned Opc) {
     }
   } else {
     switch (Lex.getKind()) {
-    default: TokError("expected icmp predicate (e.g. 'eq')");
+    default: return TokError("expected icmp predicate (e.g. 'eq')");
     case lltok::kw_eq:  P = CmpInst::ICMP_EQ; break;
     case lltok::kw_ne:  P = CmpInst::ICMP_NE; break;
     case lltok::kw_slt: P = CmpInst::ICMP_SLT; break;
index 6fd6abdccf083c399c5a8097d82a96609ecb06d6..272bf43a068770adcba1fe98857ea2e998fbb2ae 100644 (file)
@@ -4,5 +4,5 @@
 @G1 = global i8 zeroinitializer
 @g = constant <2 x i8*> getelementptr (<2 x i8*> <i8* @G1, i8* @G1>, <2 x i32> <i32 0, i32 0>)
 
-@t = constant <2 x i1> icmp ((<2 x i32> ptrtoint (<2 x i8*> zeroinitializer to <2 x i32>), <2 x i32> zeroinitializer )
+@t = constant <2 x i1> icmp eq (<2 x i32> ptrtoint (<2 x i8*> zeroinitializer to <2 x i32>), <2 x i32> zeroinitializer )
 
index f84a7dd1aae9532bf371a9831aad084716f4380d..8cf04d1765b96e9f8f33390d8adf610e18a12e6e 100644 (file)
@@ -19,9 +19,9 @@ define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
   ; CHECK-NEXT: store
   ; CHECK-NEXT: store
   ; CHECK-NEXT: ret
-  %C = fcmp eq float %A, %B
+  %C = fcmp oeq float %A, %B
   store i1 %C, i1* %PA
-  %D = fcmp eq float %B, %A
+  %D = fcmp oeq float %B, %A
   store i1 %D, i1* %PB
   ret void
 }
index 2f458fb2f1980242e43921f79eb92d050eef94b9..6aa905f87f9e15bfa3a2b16134d40cd4b5688150 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt -loop-idiom < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -S | FileCheck %s
-
+booom
 ;To recognize this pattern:
 ;int popcount(unsigned long long a) {
 ;    int c = 0;