| # Make sure we do not create illegal packet. |
| # RUN: llc -march=hexagon -run-pass global-sched -debug %s -o - | FileCheck %s |
| # REQUIRES: asserts |
| |
| # CHECK-NOT: Non newifiable in this bundle |
| |
| --- | |
| ; ModuleID = 'test.ll' |
| source_filename = "test.c" |
| target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048" |
| target triple = "hexagon-unknown-unknown-elf" |
| |
| %struct.S = type { [2 x i64], [128 x i8] } |
| |
| ; Function Attrs: nounwind |
| define dso_local i32 @f0(%struct.S* %ctx, i8* nocapture readnone %input, i32 %ilen) local_unnamed_addr #0 { |
| entry: |
| %cmp = icmp eq i32 %ilen, 0 |
| br i1 %cmp, label %cleanup, label %if.end |
| |
| if.end: ; preds = %entry |
| %cgep58 = bitcast %struct.S* %ctx to %struct.S* |
| %cgep5259 = bitcast %struct.S* %cgep58 to i64* |
| %0 = load i64, i64* %cgep5259, align 8 |
| %1 = trunc i64 %0 to i32 |
| %conv = and i32 %1, 127 |
| %conv1 = sext i32 %ilen to i64 |
| %2 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %0, i64 %conv1) |
| %math = extractvalue { i64, i1 } %2, 0 |
| %ov = extractvalue { i64, i1 } %2, 1 |
| %cgep5360 = bitcast %struct.S* %cgep58 to i64* |
| store i64 %math, i64* %cgep5360, align 8 |
| br i1 %ov, label %if.then9, label %if.end12 |
| |
| if.then9: ; preds = %if.end |
| %3 = bitcast %struct.S* %ctx to %struct.S* |
| %cgep4 = bitcast %struct.S* %3 to %struct.S* |
| %cgep2 = getelementptr inbounds %struct.S, %struct.S* %cgep4, i32 0, i32 0, i32 1 |
| %4 = load i64, i64* %cgep2, align 8 |
| %inc = add i64 %4, 1 |
| %cgep3 = getelementptr inbounds %struct.S, %struct.S* %cgep4, i32 0, i32 0, i32 1 |
| store i64 %inc, i64* %cgep3, align 8 |
| br label %if.end12 |
| |
| if.end12: ; preds = %if.then9, %if.end |
| %tobool = icmp ne i32 %conv, 0 |
| %cmp13 = icmp sle i32 %conv, %ilen |
| %or.cond = and i1 %tobool, %cmp13 |
| br i1 %or.cond, label %if.then15, label %if.end20 |
| |
| if.then15: ; preds = %if.end12 |
| %call = tail call i32 @f1(%struct.S* nonnull %ctx) #3 |
| %cmp16 = icmp eq i32 %call, 0 |
| br i1 %cmp16, label %if.end19, label %cleanup |
| |
| if.end19: ; preds = %if.then15 |
| %sub = sub nsw i32 %ilen, %conv |
| br label %if.end20 |
| |
| if.end20: ; preds = %if.end19, %if.end12 |
| %ilen.addr.0 = phi i32 [ %sub, %if.end19 ], [ %ilen, %if.end12 ] |
| %cmp2148 = icmp sgt i32 %ilen.addr.0, 127 |
| br i1 %cmp2148, label %while.body, label %cleanup |
| |
| while.cond: ; preds = %while.body |
| %cmp21 = icmp sgt i32 %sub28, 127 |
| br i1 %cmp21, label %while.body, label %cleanup |
| |
| while.body: ; preds = %if.end20, %while.cond |
| %ilen.addr.149 = phi i32 [ %sub28, %while.cond ], [ %ilen.addr.0, %if.end20 ] |
| %call23 = tail call i32 @f1(%struct.S* %ctx) #3 |
| %cmp24 = icmp eq i32 %call23, 0 |
| %sub28 = add nsw i32 %ilen.addr.149, -128 |
| br i1 %cmp24, label %while.cond, label %cleanup |
| |
| cleanup: ; preds = %while.body, %while.cond, %if.end20, %if.then15, %entry |
| %retval.0 = phi i32 [ 0, %entry ], [ %call, %if.then15 ], [ 0, %if.end20 ], [ 0, %while.cond ], [ %call23, %while.body ] |
| ret i32 %retval.0 |
| } |
| |
| declare dso_local i32 @f1(%struct.S*) local_unnamed_addr |
| |
| ; Function Attrs: nounwind readnone speculatable willreturn |
| declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) |
| |
| ; Function Attrs: nounwind |
| declare void @llvm.stackprotector(i8*, i8**) |
| |
| attributes #0 = { nounwind "target-cpu"="hexagonv71" "target-features"="+v67,-long-calls,-small-data" "use-soft-float"="false" } |
| |
| ... |
| --- |
| name: f0 |
| alignment: 16 |
| exposesReturnsTwice: false |
| legalized: false |
| regBankSelected: false |
| selected: false |
| failedISel: false |
| tracksRegLiveness: true |
| hasWinCFI: false |
| registers: [] |
| liveins: |
| - { reg: '$r0', virtual-reg: '' } |
| - { reg: '$r2', virtual-reg: '' } |
| frameInfo: |
| isFrameAddressTaken: false |
| isReturnAddressTaken: false |
| hasStackMap: false |
| hasPatchPoint: false |
| stackSize: 16 |
| offsetAdjustment: 0 |
| maxAlignment: 1 |
| adjustsStack: true |
| hasCalls: true |
| stackProtector: '' |
| maxCallFrameSize: 0 |
| cvBytesOfCalleeSavedRegisters: 0 |
| hasOpaqueSPAdjustment: false |
| hasVAStart: false |
| hasMustTailInVarArgFunc: false |
| localFrameSize: 0 |
| savePoint: [] |
| restorePoint: [] |
| fixedStack: |
| - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: default, |
| callee-saved-register: '$d8', callee-saved-restored: true, debug-info-variable: '', |
| debug-info-expression: '', debug-info-location: '' } |
| - { id: 1, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: default, |
| callee-saved-register: '$d9', callee-saved-restored: true, debug-info-variable: '', |
| debug-info-expression: '', debug-info-location: '' } |
| stack: [] |
| callSites: [] |
| constants: [] |
| machineFunctionInfo: {} |
| body: | |
| bb.0.entry: |
| successors: %bb.11(0x30000000), %bb.1(0x50000000) |
| liveins: $r0:0x00000001, $r2:0x00000001, $d8, $d9, $d8, $d9, $r16, $r17, $r18, $r19 |
| |
| frame-setup BUNDLE implicit-def $r29, implicit-def $r30, implicit-def $p0, implicit killed $r29, implicit killed $framekey, implicit killed $framelimit, implicit $r30, implicit killed $r31, implicit $r2, implicit killed $d8 { |
| $r29 = frame-setup S2_allocframe killed $r29, 16, implicit-def $r30, implicit killed $framekey, implicit killed $framelimit, implicit $r30, implicit killed $r31 :: (store 4 into stack) |
| renamable $p0 = C2_cmpeqi $r2, 0 |
| S2_storerd_io internal $r29, -16, killed $d8 :: (store 8 into %fixed-stack.0) |
| } |
| BUNDLE implicit-def $pc, implicit killed $r29, implicit killed $d9, implicit $p0 { |
| S2_storerd_io killed $r29, 0, killed $d9 :: (store 8 into %fixed-stack.1) |
| J2_jumpt $p0, %bb.11, implicit-def $pc |
| } |
| |
| bb.1.if.end: |
| successors: %bb.2(0x40000000), %bb.3(0x40000000) |
| liveins: $p0, $r0, $r2 |
| |
| BUNDLE implicit-def $r18, implicit-def $r16, implicit-def $d0, implicit-def $r0, implicit-def $r1, implicit-def $p0, implicit killed $r0, implicit $r2, implicit undef $p0 { |
| $r18 = A2_tfr $r0 |
| $r16 = A2_tfr $r2 |
| renamable $d0 = L2_loadrd_io killed $r0, 0 :: (load 8 from %ir.cgep5259) |
| $p0 = C2_andn undef $p0, undef $p0 |
| } |
| renamable $r17 = S2_asr_i_r killed $r2, 31 |
| BUNDLE implicit-def $d1, implicit-def $r2, implicit-def $r3, implicit-def $p0, implicit-def $r17, implicit $d0, implicit $d8, implicit $p0, implicit killed $r0 { |
| renamable $d1, renamable $p0 = A4_addp_c renamable $d0, renamable $d8, renamable $p0 |
| renamable $r17 = A2_andir killed renamable $r0, 127 |
| } |
| BUNDLE implicit-def dead $pc, implicit $r18, implicit killed $d1, implicit $p0 { |
| S2_storerd_io renamable $r18, 0, killed renamable $d1 :: (store 8 into %ir.cgep5360) |
| J2_jumpf renamable $p0, %bb.3, implicit-def dead $pc |
| } |
| |
| bb.2.if.then9: |
| successors: %bb.3(0x80000000) |
| liveins: $r16, $r17, $r18 |
| |
| BUNDLE implicit-def $d0, implicit-def $r0, implicit-def $r1, implicit-def $d1, implicit-def $r2, implicit-def $r3, implicit $r18 { |
| renamable $d0 = L2_loadrd_io renamable $r18, 8 :: (load 8 from %ir.cgep2) |
| renamable $d1 = A2_tfrpi 1 |
| } |
| renamable $d0 = A2_addp killed renamable $d0, killed renamable $d1 |
| S2_storerd_io renamable $r18, 8, killed renamable $d0 :: (store 8 into %ir.cgep3) |
| |
| bb.3.if.end12: |
| successors: %bb.4(0x60000000), %bb.7(0x20000000) |
| liveins: $r16, $r17, $r18 |
| |
| BUNDLE implicit-def dead $p0, implicit-def $pc, implicit $r17 { |
| renamable $p0 = C2_cmpeqi renamable $r17, 0 |
| J2_jumptnew internal $p0, %bb.7, implicit-def $pc |
| } |
| |
| bb.4.if.end12: |
| successors: %bb.5(0x55555555), %bb.7(0x2aaaaaab) |
| liveins: $r16, $r17, $r18 |
| |
| BUNDLE implicit-def dead $p0, implicit-def $pc, implicit $r17, implicit $r16 { |
| renamable $p0 = C2_cmpgt renamable $r17, renamable $r16 |
| J2_jumptnew internal $p0, %bb.7, implicit-def $pc |
| } |
| |
| bb.5.if.then15: |
| successors: %bb.7(0x30000000), %bb.13(0x50000000) |
| liveins: $r16, $r17, $r18 |
| |
| BUNDLE implicit-def $r0, implicit-def $pc, implicit-def $r31, implicit-def $r29, implicit $r18, implicit $r29 { |
| $r0 = A2_tfr $r18 |
| J2_call @f1, hexagoncsr, implicit-def $pc, implicit-def $r31, implicit $r29, implicit internal $r0, implicit-def $r29, implicit-def $r0 |
| } |
| BUNDLE implicit-def $r16, implicit-def dead $p0, implicit-def dead $pc, implicit killed $r16, implicit killed $r17, implicit $r0 { |
| renamable $r16 = nsw A2_sub killed renamable $r16, killed renamable $r17 |
| renamable $p0 = C2_cmpeqi renamable $r0, 0 |
| J2_jumpfnewpt internal renamable $p0, %bb.13, implicit-def dead $pc |
| } |
| |
| bb.7.if.end20: |
| successors: %bb.8(0x40000000), %bb.13(0x40000000) |
| liveins: $r16, $r18 |
| |
| BUNDLE implicit-def $r0, implicit-def dead $p0, implicit-def $pc, implicit $r16 { |
| renamable $r0 = A2_tfrsi 0 |
| renamable $p0 = C2_cmpgti renamable $r16, 127 |
| J2_jumpfnewpt internal $p0, %bb.13, implicit-def $pc |
| } |
| |
| bb.8.while.body (align 16): |
| successors: %bb.9(0x7c000000), %bb.13(0x04000000) |
| liveins: $r16, $r18 |
| |
| BUNDLE implicit-def $r0, implicit-def $pc, implicit-def $r31, implicit-def $r29, implicit $r18, implicit $r29 { |
| $r0 = A2_tfr $r18 |
| J2_call @f1, hexagoncsr, implicit-def $pc, implicit-def $r31, implicit $r29, implicit internal $r0, implicit-def $r29, implicit-def $r0 |
| } |
| BUNDLE implicit-def $r16, implicit-def dead $p0, implicit-def $pc, implicit killed $r16, implicit $r0 { |
| renamable $r16 = nsw A2_addi killed renamable $r16, -128 |
| renamable $p0 = C2_cmpeqi renamable $r0, 0 |
| J2_jumpfnew internal $p0, %bb.13, implicit-def $pc |
| } |
| |
| bb.9.while.cond: |
| successors: %bb.8(0x7c000000), %bb.10(0x04000000) |
| liveins: $r16, $r18, $r16 |
| |
| BUNDLE implicit-def dead $p0, implicit-def $pc, implicit $r16 { |
| renamable $p0 = C2_cmpgti renamable $r16, 127 |
| J2_jumptnewpt internal renamable $p0, %bb.8, implicit-def $pc |
| } |
| |
| bb.10: |
| successors: %bb.13(0x80000000) |
| |
| BUNDLE implicit-def $r0, implicit-def $pc { |
| renamable $r0 = A2_tfrsi 0 |
| J2_jump %bb.13, implicit-def $pc |
| } |
| |
| bb.11: |
| successors: %bb.13(0x80000000) |
| |
| renamable $r0 = A2_tfrsi 0 |
| |
| bb.13.cleanup: |
| liveins: $r0 |
| |
| BUNDLE implicit-def $d8, implicit-def $r16, implicit-def $r17, implicit-def $d9, implicit-def $r18, implicit-def $r19, implicit killed $r29 { |
| $d8 = L2_loadrd_io $r29, 8 :: (load 8 from %fixed-stack.0) |
| $d9 = L2_loadrd_io killed $r29, 0 :: (load 8 from %fixed-stack.1) |
| } |
| $d15 = L4_return killed $r30, implicit-def $pc, implicit-def $r29, implicit killed $framekey, implicit-def $pc, implicit killed $r0, implicit killed $d8, implicit killed $d9 |
| |
| ... |