[LLVMdev] Is it possible to create a variable that aliases a field in a struct ?

sebastien deldon (PGI) sebastien.deldon at pgroup.com
Fri Jun 13 02:05:10 PDT 2014


Hi all,

I would like to create a variable that aliases a field in a struct like :

%struct._dpowk_16 = type < { [32 x [32 x double]], [32 x [32 x double]], [32 x [32 x i64]] } >

@_dpowk_16 = common addrspace(1) global %struct._dpowk_16  zeroinitializer, align 16
@r_d_alias = alias [32 x [32 x double]] addrspace(1) * bitcast (i8 addrspace(1) * getelementptr (i8 addrspace(1) * bitcast (%struct._dpowk_16 addrspace(1)* @_dpowk_16 to i8 addrspace(1) *), i64 8192) to [32 x [32 x double]] addrspace(1) * )

When I use opt I got following message :

Aliasee should be either GlobalValue or bitcast of GlobalValue
[32 x [32 x double]] addrspace(1)* @r_d_alias
Broken module found, compilation aborted!
0  opt             0x00000000010e3abf
1  opt             0x00000000010e5a22
2  libpthread.so.0 0x0000003dd0a0f710
3  libc.so.6       0x0000003dd0232925 gsignal + 53
4  libc.so.6       0x0000003dd0234105 abort + 373
5  opt             0x00000000010a3e8a
6  opt             0x000000000107c654 llvm::FPPassManager::doFinalization(llvm::Module&) + 84
7  opt             0x000000000107df79 llvm::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 105
8  opt             0x000000000053b25d main + 6829
9  libc.so.6       0x0000003dd021ed1d __libc_start_main + 253
10 opt             0x000000000052c5c9
Stack dump:

0.                Program arguments: opt -O2 -S gblmod.ll -o gblmod.opt.ll

Is there a way to have a global value that reflects a field in a struct ?

Thanks for your answers
Seb

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140613/f9aaa8bf/attachment.html>


More information about the llvm-dev mailing list