-debug and -print-machineinstrs broken

Are these known to be broken right now? I get failure when using either.

$ llc -march=arm -print-machineinstrs hw.bc
...
BB#0: derived from LLVM BB %entry
     Live Ins: %LR %R7
  %SP<def> = SUBri %SP<kill>, 8, 14, %reg0, %reg0
  STR %LR<kill>, %SP, %reg0, 4, 14, %reg0; mem:ST4[0 llc 0x008b3304 PrintStackTrace(void*) + 45
1 llc 0x008b390c SignalHandler(int) + 410
2 libSystem.B.dylib 0x93130b9b _sigtramp + 43
3 libSystem.B.dylib 0xffffffff _sigtramp + 1827468431
4 llc 0x0078d74b createSlotTracker(llvm::Value const*) + 114
5 llc 0x00790c21 WriteAsOperandInternal(llvm::raw_ostream&, llvm::Value const*, llvm::TypePrinting*, (anonymous namespace)::SlotTracker*) + 799
6 llc 0x00794089 llvm::WriteAsOperand(llvm::raw_ostream&, llvm::Value const*, bool, llvm::Module const*) + 126
7 llc 0x005dce23 llvm::operator<<(llvm::raw_ostream&, llvm::MachineMemOperand const&) + 358
8 llc 0x005de0c4 llvm::MachineInstr::print(llvm::raw_ostream&, llvm::TargetMachine const*) const + 1166
9 llc 0x005c9242 llvm::MachineBasicBlock::print(llvm::raw_ostream&) const + 910
10 llc 0x005d2cd5 llvm::MachineFunction::print(llvm::raw_ostream&) const + 1033
11 llc 0x005d2dcf (anonymous namespace)::printer::runOnMachineFunction(llvm::MachineFunction&) + 97
12 llc 0x005d8e33 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 77
13 llc 0x00835d21 llvm::FPPassManager::runOnFunction(llvm::Function&) + 271
14 llc 0x00837a24 llvm::FunctionPassManagerImpl::run(llvm::Function&) + 112
15 llc 0x00837bf0 llvm::FunctionPassManager::run(llvm::Function&) + 130
16 llc 0x0002b343 main + 3448
17 llc 0x00029e21 start + 53
Stack dump:
0. Program arguments: llc -march=arm -print-machineinstrs hw.bc
1. Running pass 'MachineFunction Printer' on function '@main'
Bus error

Are these known to be broken right now? I get failure when using either.

$ llc -march=arm -print-machineinstrs hw.bc

Seems due to David's patches.

Ok. Send me a testcase and I will fix. This should be put into
the testbase.

                            -Dave

Many files seem to fail. I've attached a small one...

hw.bc (608 Bytes)

Ok, it's faulting in SlotTracker with what looks like a bad Function. One of
the Argument values is corrupted.

I'm not abdicating responsibility, but at the moment I don't see the
connection to my patches. Anton, are you seeing something specific
as to the cause?

I will keep investigating.

                                  -Dave

Somehow a MachineIntr memoperand is pointing to an Instruction. That's not
supposed to happen, is it?

I saw the symptom change after updating to ToT so I suspect this is a
rather subtle memory corruption problem.

                             -Dave

The cause was isa<Instruction> was returning true for the new
FixedStackPseudoSourceValue values. I fixed it on trunk, and
added a comment to hopefully protect against others making
this mistake in the future.

Dan

Dan just fixed it. I was just about to the same point he got to. :slight_smile:

                               -Dave

Is there any value is making isa<>, cast<> and friends a full dynamic_cast<>
in paranoid build mode? It could help identify problems like this.

                                   -Dave

Sorry, I used my own lingo there. By "paranoid" I mean
--enable-expensive-checks. Another option would be to check
cast<>, isa<>, etc. against dynamic_cast<> with --enable-expensive-checks.

                                      -Dave