llvm-project/llvm/test/CodeGen/MSP430
Anton Korobeynikov 064dbac212 `MSP430InstrInfo::loadRegFromStackSlot` forgets to set register def.
Summary:
For instance, compiling the below results in a panic:

```
llc: ../lib/CodeGen/InlineSpiller.cpp:1140: bool (anonymous namespace)::InlineSpiller::foldMemoryOperand(ArrayRef<std::pair<MachineInstr *, unsigned int> >, llvm::MachineInstr *): Assertion `MO->isDead() && "Cannot fold physreg def"' failed.
 0x00007f50fbcf353e llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:321:15
 0x00007f50fbcf3929 PrintStackTraceSignalHandler(void*) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:380:1
 0x00007f50fbcf22a3 llvm::sys::RunSignalHandlers() /home/h/3rd/llvm/build/../lib/Support/Signals.cpp:45:5
 0x00007f50fbcf3bb4 SignalHandler(int) /home/h/3rd/llvm/build/../lib/Support/Unix/Signals.inc:210:1
 0x00007f50fa87a180 (/lib/x86_64-linux-gnu/libc.so.6+0x35180)
 0x00007f50fa87a107 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35107)
 0x00007f50fa87b4e8 abort (/lib/x86_64-linux-gnu/libc.so.6+0x364e8)
 0x00007f50fa873226 (/lib/x86_64-linux-gnu/libc.so.6+0x2e226)
 0x00007f50fa8732d2 (/lib/x86_64-linux-gnu/libc.so.6+0x2e2d2)
 0x00007f50fddd9287 (anonymous namespace)::InlineSpiller::foldMemoryOperand(llvm::ArrayRef<std::pair<llvm::MachineInstr*, unsigned int> >, llvm::MachineInstr*) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1141:21
 0x00007f50fddd9ee9 (anonymous namespace)::InlineSpiller::spillAroundUses(unsigned int) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1286:9
 0x00007f50fddd388b (anonymous namespace)::InlineSpiller::spillAll() /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1338:21
 0x00007f50fddd221d (anonymous namespace)::InlineSpiller::spill(llvm::LiveRangeEdit&) /home/h/3rd/llvm/build/../lib/CodeGen/InlineSpiller.cpp:1391:3
 0x00007f50fdfd921b (anonymous namespace)::RAGreedy::selectOrSplitImpl(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&, llvm::SmallSet<unsigned int, 16u, std::less<unsigned int> >&, unsigned int) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2555:5
 0x00007f50fdfd647b (anonymous namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2221:12
 0x00007f50fdfc89f9 llvm::RegAllocBase::allocatePhysRegs() /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocBase.cpp:110:14
 0x00007f50fdfd6337 (anonymous namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) /home/h/3rd/llvm/build/../lib/CodeGen/RegAllocGreedy.cpp:2611:3
 0x00007f50fded33ee llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/h/3rd/llvm/build/../lib/CodeGen/MachineFunctionPass.cpp:43:3
 0x00007f50fd6cdc6f llvm::FPPassManager::runOnFunction(llvm::Function&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1550:23
 0x00007f50fd6cdf85 llvm::FPPassManager::runOnModule(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1571:16
 0x00007f50fd6ce71a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1627:23
 0x00007f50fd6ce246 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1730:16
 0x00007f50fd6cec31 llvm::legacy::PassManager::run(llvm::Module&) /home/h/3rd/llvm/build/../lib/IR/LegacyPassManager.cpp:1761:3
 0x0000000000415bdc compileModule(char**, llvm::LLVMContext&) /home/h/3rd/llvm/build/../tools/llc/llc.cpp:405:5
 0x0000000000414571 main /home/h/3rd/llvm/build/../tools/llc/llc.cpp:211:13
 0x00007f50fa866b45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b45)
 0x0000000000414296 _start (/home/h/3rd/llvm/build/bin/llc+0x414296)
Stack dump:
0.	Program arguments: ./bin/llc -mtriple msp430 loadstore.ll 
1.	Running pass 'Function Pass Manager' on module 'loadstore.ll'.
2.	Running pass 'Greedy Register Allocator' on function '@inc'
```

Original IR:

```llvm
%struct.VeryLarge = type { i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: norecurse nounwind
define void @inc(%struct.VeryLarge* noalias nocapture sret %agg.result, %struct.VeryLarge* byval align 1 %s)  {
entry:
  %p0 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 0
  %0 = load i8, i8* %p0, align 1, !tbaa 
  %p1 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 1
  %1 = load i32, i32* %p1, align 1, !tbaa 
  %p2 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 2
  %2 = load i32, i32* %p2, align 1, !tbaa 
  %p3 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 3
  %3 = load i32, i32* %p3, align 1, !tbaa 
  %p4 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 4
  %4 = load i32, i32* %p4, align 1, !tbaa 
  %p5 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 5
  %5 = load i32, i32* %p5, align 1, !tbaa 
  %p6 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 6
  %6 = load i32, i32* %p6, align 1, !tbaa 
  %p7 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 7
  %7 = load i32, i32* %p7, align 1, !tbaa 
  %p8 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 8
  %8 = load i32, i32* %p8, align 1, !tbaa 
  %p9 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 9
  %9 = load i32, i32* %p9, align 1, !tbaa 
  %p10 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 10
  %10 = load i32, i32* %p10, align 1, !tbaa 
  %p11 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 11
  %11 = load i32, i32* %p11, align 1, !tbaa 
  %p12 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 12
  %12 = load i32, i32* %p12, align 1, !tbaa 
  %p13 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 13
  %13 = load i32, i32* %p13, align 1, !tbaa 
  %p14 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 14
  %14 = load i32, i32* %p14, align 1, !tbaa 
  %p15 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 15
  %15 = load i32, i32* %p15, align 1, !tbaa 
  %p16 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 16
  %16 = load i32, i32* %p16, align 1, !tbaa 
  %p17 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 17
  %17 = load i32, i32* %p17, align 1, !tbaa 
  %p18 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 18
  %18 = load i32, i32* %p18, align 1, !tbaa 
  %p19 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 19
  %19 = load i32, i32* %p19, align 1, !tbaa 
  %p20 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 20
  %20 = load i32, i32* %p20, align 1, !tbaa 
  %p21 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 21
  %21 = load i32, i32* %p21, align 1, !tbaa 
  %p22 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 22
  %22 = load i32, i32* %p22, align 1, !tbaa 
  %p23 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 23
  %23 = load i32, i32* %p23, align 1, !tbaa 
  %p24 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 24
  %24 = load i32, i32* %p24, align 1, !tbaa 
  %p25 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 25
  %25 = load i32, i32* %p25, align 1, !tbaa 
  %p26 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 26
  %26 = load i32, i32* %p26, align 1, !tbaa 
  %p27 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 27
  %27 = load i32, i32* %p27, align 1, !tbaa 
  %p28 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 28
  %28 = load i32, i32* %p28, align 1, !tbaa 
  %p29 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 29
  %29 = load i32, i32* %p29, align 1, !tbaa 
  %p30 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 30
  %30 = load i32, i32* %p30, align 1, !tbaa 
  %p31 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 31
  %31 = load i32, i32* %p31, align 1, !tbaa 
  %p32 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %s, i32 0, i32 32
  %32 = load i32, i32* %p32, align 1, !tbaa 
  %add = add i8 %0, 1
  store i8 %add, i8* %p0, align 1, !tbaa 
  %add2 = add i32 %1, 2
  store i32 %add2, i32* %p1, align 1, !tbaa 
  %add3 = add i32 %2, 3
  store i32 %add3, i32* %p2, align 1, !tbaa 
  %add4 = add i32 %3, 4
  store i32 %add4, i32* %p3, align 1, !tbaa 
  %add5 = add i32 %4, 5
  store i32 %add5, i32* %p4, align 1, !tbaa 
  %add6 = add i32 %5, 6
  store i32 %add6, i32* %p5, align 1, !tbaa 
  %add7 = add i32 %6, 7
  store i32 %add7, i32* %p6, align 1, !tbaa 
  %add8 = add i32 %7, 8
  store i32 %add8, i32* %p7, align 1, !tbaa 
  %add9 = add i32 %8, 9
  store i32 %add9, i32* %p8, align 1, !tbaa 
  %add10 = add i32 %9, 10
  store i32 %add10, i32* %p9, align 1, !tbaa 
  %add11 = add i32 %10, 11
  store i32 %add11, i32* %p10, align 1, !tbaa 
  %add12 = add i32 %11, 12
  store i32 %add12, i32* %p11, align 1, !tbaa 
  %add13 = add i32 %12, 13
  store i32 %add13, i32* %p12, align 1, !tbaa 
  %add14 = add i32 %13, 14
  store i32 %add14, i32* %p13, align 1, !tbaa 
  %add15 = add i32 %14, 15
  store i32 %add15, i32* %p14, align 1, !tbaa 
  %add16 = add i32 %15, 16
  store i32 %add16, i32* %p15, align 1, !tbaa 
  %add17 = add i32 %16, 17
  store i32 %add17, i32* %p16, align 1, !tbaa 
  %add18 = add i32 %17, 18
  store i32 %add18, i32* %p17, align 1, !tbaa 
  %add19 = add i32 %18, 19
  store i32 %add19, i32* %p18, align 1, !tbaa 
  %add20 = add i32 %19, 20
  store i32 %add20, i32* %p19, align 1, !tbaa 
  %add21 = add i32 %20, 21
  store i32 %add21, i32* %p20, align 1, !tbaa 
  %add22 = add i32 %21, 22
  store i32 %add22, i32* %p21, align 1, !tbaa 
  %add23 = add i32 %22, 23
  store i32 %add23, i32* %p22, align 1, !tbaa 
  %add24 = add i32 %23, 24
  store i32 %add24, i32* %p23, align 1, !tbaa 
  %add25 = add i32 %24, 25
  store i32 %add25, i32* %p24, align 1, !tbaa 
  %add26 = add i32 %25, 26
  store i32 %add26, i32* %p25, align 1, !tbaa 
  %add27 = add i32 %26, 27
  store i32 %add27, i32* %p26, align 1, !tbaa 
  %add28 = add i32 %27, 28
  store i32 %add28, i32* %p27, align 1, !tbaa 
  %add29 = add i32 %28, 29
  store i32 %add29, i32* %p28, align 1, !tbaa 
  %add30 = add i32 %29, 30
  store i32 %add30, i32* %p29, align 1, !tbaa 
  %add31 = add i32 %30, 31
  store i32 %add31, i32* %p30, align 1, !tbaa 
  %add32 = add i32 %31, 32
  store i32 %add32, i32* %p31, align 1, !tbaa 
  %add33 = add i32 %32, 33
  store i32 %add33, i32* %p32, align 1, !tbaa 
  %33 = getelementptr inbounds %struct.VeryLarge, %struct.VeryLarge* %agg.result, i32 0, i32 0
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %33, i8* %p0, i32 129, i32 1, i1 false), !tbaa.struct 
  ret void
}

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) 

attributes  = { norecurse nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes  = { argmemonly nounwind }

!llvm.ident = !{!0}

 = !{!"clang version 3.8.0 (git://github.com/llvm-mirror/clang 40ef2b7531472c41212c4719a9294aeb7bddebbc) (git://github.com/llvm-mirror/llvm c601eaf55606dfb9ad372b514b77aa00d1409be1)"}
 = !{!2, , i64 0}
 = !{!"", , i64 0, , i64 1, , i64 5, , i64 9, , i64 13, , i64 17, , i64 21, , i64 25, , i64 29, , i64 33, , i64 37, , i64 41, , i64 45, , i64 49, , i64 53, , i64 57, , i64 61, , i64 65, , i64 69, , i64 73, , i64 77, , i64 81, , i64 85, , i64 89, , i64 93, , i64 97, , i64 101, , i64 105, , i64 109, , i64 113, , i64 117, , i64 121, , i64 125}
 = !{!"omnipotent char", , i64 0}
 = !{!"Simple C/C++ TBAA"}
 = !{!"int", , i64 0}
 = !{!2, , i64 1}
 = !{!2, , i64 5}
 = !{!2, , i64 9}
 = !{!2, , i64 13}
 = !{!2, , i64 17}
 = !{!2, , i64 21}
 = !{!2, , i64 25}
 = !{!2, , i64 29}
 = !{!2, , i64 33}
 = !{!2, , i64 37}
 = !{!2, , i64 41}
 = !{!2, , i64 45}
 = !{!2, , i64 49}
 = !{!2, , i64 53}
 = !{!2, , i64 57}
 = !{!2, , i64 61}
 = !{!2, , i64 65}
 = !{!2, , i64 69}
 = !{!2, , i64 73}
 = !{!2, , i64 77}
 = !{!2, , i64 81}
 = !{!2, , i64 85}
 = !{!2, , i64 89}
 = !{!2, , i64 93}
 = !{!2, , i64 97}
 = !{!2, , i64 101}
 = !{!2, , i64 105}
 = !{!2, , i64 109}
 = !{!2, , i64 113}
 = !{!2, , i64 117}
 = !{!2, , i64 121}
 = !{!2, , i64 125}
 = !{i64 0, i64 1, , i64 1, i64 4, , i64 5, i64 4, , i64 9, i64 4, , i64 13, i64 4, , i64 17, i64 4, , i64 21, i64 4, , i64 25, i64 4, , i64 29, i64 4, , i64 33, i64 4, , i64 37, i64 4, , i64 41, i64 4, , i64 45, i64 4, , i64 49, i64 4, , i64 53, i64 4, , i64 57, i64 4, , i64 61, i64 4, , i64 65, i64 4, , i64 69, i64 4, , i64 73, i64 4, , i64 77, i64 4, , i64 81, i64 4, , i64 85, i64 4, , i64 89, i64 4, , i64 93, i64 4, , i64 97, i64 4, , i64 101, i64 4, , i64 105, i64 4, , i64 109, i64 4, , i64 113, i64 4, , i64 117, i64 4, , i64 121, i64 4, , i64 125, i64 4, !40}
 = !{!3, , i64 0}
 = !{!5, , i64 0}
```



Reviewers: asl

Subscribers: qcolombet

Differential Revision: http://reviews.llvm.org/D17441

llvm-svn: 261746
2016-02-24 15:15:02 +00:00
..
2009-05-10-CyclicDAG.ll
2009-05-17-Rot.ll
2009-05-17-Shift.ll
2009-05-19-DoubleSplit.ll
2009-08-25-DynamicStackAlloc.ll
2009-09-18-AbsoluteAddr.ll
2009-10-10-OrImpDef.ll
2009-11-05-8BitLibcalls.ll
2009-11-08-InvalidResNo.ll
2009-11-20-NewNode.ll
2009-12-21-FrameAddr.ll
2009-12-22-InlineAsm.ll
2010-05-01-CombinerAnd.ll
AddrMode-bis-rx.ll
AddrMode-bis-xr.ll
AddrMode-mov-rx.ll
AddrMode-mov-xr.ll
DbgValueOtherTargets.test
Inst8mi.ll
Inst8mm.ll
Inst8mr.ll
Inst8ri.ll
Inst8rm.ll
Inst8rr.ll
Inst16mi.ll
Inst16mm.ll
Inst16mr.ll
Inst16ri.ll
Inst16rm.ll
Inst16rr.ll
asm-clobbers.ll
bit.ll
byval.ll
cc_args.ll
cc_ret.ll
fp.ll
indirectbr.ll
indirectbr2.ll
inline-asm.ll
jumptable.ll
lit.local.cfg
memset.ll
misched-msp430.ll
mult-alt-generic-msp430.ll
postinc.ll
setcc.ll
shifts.ll
spill-to-stack.ll `MSP430InstrInfo::loadRegFromStackSlot` forgets to set register def. 2016-02-24 15:15:02 +00:00
transient-stack-alignment.ll
vararg.ll