| Pete Cooper | 2127b00 | 2015-04-30 23:57:47 +0000 | [diff] [blame] | 1 | ; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" |
| 4 | target triple = "thumbv7s-apple-unknown" |
| 5 | |
| 6 | ; The subtract instruction %3 will be optimized (combined and predicated) with the select |
| 7 | ; inside the loop. In this case, the kill flag on the subtract should be removed or else |
| 8 | ; it will fail verification. |
| 9 | |
| 10 | %struct.PROOFSEARCH_HELP = type { %struct.LIST_HELP*, %struct.LIST_HELP*, %struct.LIST_HELP*, %struct.LIST_HELP*, %struct.SHARED_INDEX_NODE*, %struct.LIST_HELP*, %struct.SHARED_INDEX_NODE*, %struct.LIST_HELP*, %struct.SORTTHEORY_HELP*, %struct.SORTTHEORY_HELP*, %struct.SORTTHEORY_HELP*, %struct.SHARED_INDEX_NODE*, %struct.LIST_HELP*, i32*, i32*, %struct.LIST_HELP*, i32, i32, i32, i32, i32, i32, i32, i32 } |
| 11 | %struct.SORTTHEORY_HELP = type { %struct.st*, [4000 x %struct.NODE_HELP*], %struct.LIST_HELP*, %struct.LIST_HELP*, i32 } |
| 12 | %struct.st = type { %struct.subst*, %struct.LIST_HELP*, %struct.LIST_HELP*, i16, i16 } |
| 13 | %struct.subst = type { %struct.subst*, i32, %struct.term* } |
| 14 | %struct.term = type { i32, %union.anon, %struct.LIST_HELP*, i32, i32 } |
| 15 | %union.anon = type { %struct.LIST_HELP* } |
| 16 | %struct.NODE_HELP = type { %struct.LIST_HELP*, i32, i32, i32, %struct.LIST_HELP*, i32 } |
| 17 | %struct.SHARED_INDEX_NODE = type { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 } |
| 18 | %struct.LIST_HELP = type { %struct.LIST_HELP*, i8* } |
| 19 | %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_HELP*, %struct.LIST_HELP*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } |
| 20 | %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } |
| 21 | |
| 22 | declare void @foo(%struct.PROOFSEARCH_HELP*, %struct.CLAUSE_HELP*) |
| 23 | |
| 24 | ; CHECK-LABEL: @test |
| 25 | ; CHECK: it |
| 26 | ; CHECK-NEXT: sub |
| 27 | |
| 28 | define hidden fastcc %struct.LIST_HELP* @test(%struct.PROOFSEARCH_HELP* %Search, %struct.LIST_HELP* %ClauseList, i32 %Level, %struct.LIST_HELP** nocapture %New) { |
| 29 | entry: |
| 30 | %cmp4.i.i = icmp ugt i32 %Level, 31 |
| 31 | %0 = add i32 %Level, -32 |
| 32 | %1 = lshr i32 %0, 5 |
| 33 | %2 = shl nuw i32 %1, 5 |
| 34 | %3 = sub i32 %0, %2 |
| 35 | %4 = add nuw nsw i32 %1, 1 |
| 36 | br label %for.body |
| 37 | |
| 38 | for.body: ; preds = %for.inc, %entry |
| 39 | %Scan.038 = phi %struct.LIST_HELP* [ %ClauseList, %entry ], [ %9, %for.inc ] |
| 40 | %car.i33 = getelementptr inbounds %struct.LIST_HELP, %struct.LIST_HELP* %Scan.038, i32 0, i32 1 |
| 41 | %5 = bitcast i8** %car.i33 to %struct.CLAUSE_HELP** |
| 42 | %6 = load %struct.CLAUSE_HELP*, %struct.CLAUSE_HELP** %5, align 4 |
| 43 | %. = add i32 %4, 10 |
| 44 | %.Level = select i1 %cmp4.i.i, i32 %3, i32 %Level |
| 45 | %splitfield.i = getelementptr inbounds %struct.CLAUSE_HELP, %struct.CLAUSE_HELP* %6, i32 0, i32 4 |
| 46 | %7 = load i32*, i32** %splitfield.i, align 4 |
| 47 | %arrayidx.i = getelementptr inbounds i32, i32* %7, i32 %. |
| 48 | %8 = load i32, i32* %arrayidx.i, align 4 |
| 49 | %shl.i = shl i32 1, %.Level |
| 50 | %and.i = and i32 %8, %shl.i |
| 51 | %cmp4.i = icmp eq i32 %and.i, 0 |
| 52 | br i1 %cmp4.i, label %for.inc, label %if.then |
| 53 | |
| 54 | if.then: ; preds = %for.body |
| 55 | tail call void @foo(%struct.PROOFSEARCH_HELP* %Search, %struct.CLAUSE_HELP* %6) |
| 56 | store i8* null, i8** %car.i33, align 4 |
| 57 | br label %for.inc |
| 58 | |
| 59 | for.inc: ; preds = %if.then, %for.body |
| 60 | %cdr.i = getelementptr inbounds %struct.LIST_HELP, %struct.LIST_HELP* %Scan.038, i32 0, i32 0 |
| 61 | %9 = load %struct.LIST_HELP*, %struct.LIST_HELP** %cdr.i, align 4 |
| 62 | br label %for.body |
| 63 | } |