http://llvm.org/bugs/show_bug.cgi?id=19474
Bug ID: 19474
Summary: GlobalOpt removes SectionAttr unexpecedly
Product: libraries
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Interprocedural Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
when with globalopt, section atttribute of the variable is removed
unexpectedly. The following is the case.
#include <stdio.h>
int main()
{
static int a_var __attribute__((section("MySection")));
a_var = 0;
for (int i = 0; i<10; ++i)
a_var++;
return a_var;
}
To reproduce it,
Step1: clang++ -emit-llvm -S main.cpp -o main.ll
Step2: opt -globalopt main.ll -S -o main_opt.ll
Just after step1, the SectionAttr still clings to the variable.
@_ZZ4mainE5a_var = internal global i32 0, section "MySection", align 4
After Step2, SectionAttr is gone as belows,
@%_ZZ4mainE5a_var = alloca i32
store i32 0, i32* %_ZZ4mainE5a_var
The thing is that we need _ZZ4mainE5a_var still convey its SectionAttr
to next phase. However that is not kept for the potential reason that the
shriking process of Globalopt might not copy attribute from original.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs