55 lines · plain
1; The reason for the bug was that when deciding if a global2; variable can be part of sdata, we were wrongly ignoring3; the presence of any section specified for the variable4; using the section attribute. If such a section is specified,5; and that section is not sdata*/sbss* then the variable6; cannot use GPREL addressing, i.e. memw(#variablename).7 8; RUN: llc -mtriple=hexagon < %s | FileCheck %s9; CHECK-LABEL: foo10; CHECK-DAG: memw(##b)11; CHECK-DAG: memw(gp+#d)12; CHECK-DAG: memw(##g)13; CHECK-DAG: memw(gp+#h)14; CHECK-DAG: memw(gp+#f)15; CHECK-DAG: memw(##e)16; CHECK-DAG: memw(gp+#a)17; CHECK-DAG: memw(gp+#c)18; CHECK-LABEL: bar19; CHECK: memw(##b)20 21@b = global i32 0, section ".data.section", align 422@a = common global i32 0, align 423@d = global i32 0, section ".sbss", align 424@c = global i32 0, section ".sdata", align 425@f = global i32 0, section ".sbss.4", align 426@e = global i32 0, section ".sdatafoo", align 427@h = global i32 0, section ".sdata.4", align 428@g = global i32 0, section ".sbssfoo", align 429 30define void @foo() nounwind {31entry:32 %0 = load i32, ptr @b, align 433 store i32 %0, ptr @a, align 434 %1 = load i32, ptr @d, align 435 store i32 %1, ptr @c, align 436 %2 = load i32, ptr @f, align 437 store i32 %2, ptr @e, align 438 %3 = load i32, ptr @h, align 439 store i32 %3, ptr @g, align 440 ret void41}42 43define void @bar() nounwind section ".function.section" {44entry:45 %0 = load i32, ptr @a, align 446 store i32 %0, ptr @b, align 447 ret void48}49 50define i32 @main() nounwind readnone {51entry:52 ret i32 053}54 55