Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Wrong MachineOperand accessor error #37

Closed
@dylanmckay

Description

@dylanmckay

Assertion error:

void llvm::MachineOperand::setIsEarlyClobber(bool): Assertion `isReg() && IsDef && "Wrong MachineOperand accessor"' failed.

Code to reproduce:

C (main.c):

struct ss
{
    int a;
    int b;
    int c;
};

void loop(struct ss *x, struct ss **y, int z)
{
    int i;
    for (i=0; i<z; ++i)
    {
        x->c += y[i]->b;
    }
}

Command line:

clang --target=avr -O1 main.c -o main.o

Or alternatively:

LLVM IR (main.ll):

; ModuleID = '/home/dylan/Desktop/tmp.c'
target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-i64:8:8-f32:8:8-f64:8:8-n8"
target triple = "avr-none"

%struct.ss = type { i16, i16, i16 }

; Function Attrs: nounwind
define void @loop(%struct.ss* %x, %struct.ss** %y, i16 %z) #0 {
entry:
  %x.addr = alloca %struct.ss*, align 2
  %y.addr = alloca %struct.ss**, align 2
  %z.addr = alloca i16, align 2
  %i = alloca i16, align 2
  store %struct.ss* %x, %struct.ss** %x.addr, align 2
  store %struct.ss** %y, %struct.ss*** %y.addr, align 2
  store i16 %z, i16* %z.addr, align 2
  store i16 0, i16* %i, align 2
  br label %for.cond

for.cond:                                         ; preds = %for.inc, %entry
  %0 = load i16, i16* %i, align 2
  %1 = load i16, i16* %z.addr, align 2
  %cmp = icmp slt i16 %0, %1
  br i1 %cmp, label %for.body, label %for.end

for.body:                                         ; preds = %for.cond
  %2 = load i16, i16* %i, align 2
  %3 = load %struct.ss**, %struct.ss*** %y.addr, align 2
  %arrayidx = getelementptr inbounds %struct.ss*, %struct.ss** %3, i16 %2
  %4 = load %struct.ss*, %struct.ss** %arrayidx, align 2
  %b = getelementptr inbounds %struct.ss, %struct.ss* %4, i32 0, i32 1
  %5 = load i16, i16* %b, align 2
  %6 = load %struct.ss*, %struct.ss** %x.addr, align 2
  %c = getelementptr inbounds %struct.ss, %struct.ss* %6, i32 0, i32 2
  %7 = load i16, i16* %c, align 2
  %add = add nsw i16 %7, %5
  store i16 %add, i16* %c, align 2
  br label %for.inc

for.inc:                                          ; preds = %for.body
  %8 = load i16, i16* %i, align 2
  %inc = add nsw i16 %8, 1
  store i16 %inc, i16* %i, align 2
  br label %for.cond

for.end:                                          ; preds = %for.cond
  ret void
}

attributes #0 = { nounwind "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" }

!llvm.ident = !{!0}

!0 = !{!"clang version 3.7.0 (https://github.com/llvm-mirror/clang.git 00a0b3863ac817790d9b344da4fc499b71140a7a) (https://github.com/llvm-mirror/llvm.git 7e8c7af2467dd33d7f41b797b771221ca08dfbf3)"}

Command line:

llc main.ll -o main.o -march=avr -mcpu=avrxmega1

Tested with dedb06d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions