llvm问题积累

##Key points:-

(1)Before doing any modification on the instruction. Collect first in the worklist.

(2)perform the modification on the worklist.

(3)you cannot do the modification while using the iterator.

1、load一个地址空间为空的memory

 %.sroa.3.0.copyload = load volatile i16, i16* bitcast (i8* getelementptr inbounds (i8, i8* bitcast (%struct.str* @global to i8*), i64 14) to i16*), align 2
  store volatile i16 %.sroa.3.0.copyload, i16* %.sroa.3, align 2

暂时解决办法:将load语句删掉,调用其地方替换为value 0;

2、memcpy的问题总结:
(1)

  %.sroa.523.0.sroa_idx = getelementptr inbounds [3 x i8], [3 x i8]* %.sroa.523, i64 0, i64 0
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %.sroa.523.0.sroa_idx, i8* getelementptr inbounds (i8, i8* bitcast (%struct.str* @global to i8*), i64 17), i64 3, i32 1, i1 true)

(2)

  %global = alloca %struct.str, align 8
  %1 = bitcast %struct.str* %global to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast (%struct.str* @global to i8*), i64 56, i32 8, i1 false) #3
  br label %2

(3)

  %1 = alloca %struct.str, align 8
  %2 = getelementptr inbounds %struct.str, %struct.str* %1, i64 0, i32 0, i32 0
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull %2, i8* getelementptr inbounds (%struct.str, %struct.str* @global, i64 0, i32 0, i32 0), i64 44, i32 4, i1 false)

GlobalVarGetelementptr()
无法将处理函数移植到replaceGlobalvarGetelementprt()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值