[llvm-dev] Assertion failed: "Node emitted out of order - late"

Boris Boesler via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 2 09:11:46 PST 2015


I get the error 'Assertion failed: (I != VRBaseMap.end() && "Node emitted out of order - late")' in a simple test function. LLVM dis-assembly looks like this:

; Function Attrs: nounwind
define void @bug(i32* nocapture readnone %result, i32* nocapture readonly %sptr) #0 {
  %a = alloca [16 x i32], align 8
  %0 = bitcast [16 x i32]* %a to i8*
  call void @llvm.lifetime.start(i64 64, i8* %0) #1
  %arraydecay = getelementptr inbounds [16 x i32]* %a, i16 0, i16 0
  %sptr.addr.010 = getelementptr inbounds i32* %sptr, i16 1
  %v.0 = load i32* %sptr, align 8
  %cmp1 = icmp eq i32 %v.0, 0
  br i1 %cmp1, label %if.end, label %if.then
if.then:                                          ; preds = %entry

After scheduling there is a CopyToReg node and a llvm.lifetime.start node, both have a TargetFrameIndex<0> as operand (it is a TargetFrameIndex from the very first pass - but I expected a FrameIndex). I guess this is %a. The instruction emitter tries to get the virtual register number from the CopyToReg's operand, the TargetFrameIndex. But there is no virtual register number for TargetFrameIndex and that raises the assertion.
Well, I have lots of [Target]FrameIndex operations in other test code, but probably no arrays, and that works as expected.

I do not touch the llvm.lifetime.X intrinsics. I can leave them, right?
What did I miss to do? Why is there no virtual register for that TargetFrameIndex?


More information about the llvm-dev mailing list