从LLVM IR中删除@__ ctype_b_loc()

时间:2018-06-28 04:16:35

标签: llvm llvm-ir

我从GNU / coreutils / uniq得到以下简单循环:

char *lp = ...;
size_t size = ...;
size_t i = 0;
while (i < size && isblank (lp[i]))
{
    i++;
}

isblank在哪里:

#define isblank(c) ((c) == ' ' || (c) == '\t')

当我将其编译为LLVM IR时,我看到了这个 @__ ctype_b_loc(),我希望(理想地)将其完全删除:

while.cond:    ; preds = %while.body, %for.body
  %tmp8 = load i64, i64* %i, align 8
  %tmp9 = load i64, i64* %size, align 8
  %cmp2 = icmp ult i64 %tmp8, %tmp9
  br i1 %cmp2, label %land.rhs, label %while.cond.land.end_crit_edge

while.cond.land.end_crit_edge:    ; preds = %while.cond
  ; ...

land.rhs:    ; preds = %while.cond
  %tmp10 = load i64, i64* %i, align 8
  %tmp11 = load i8*, i8** %lp, align 8
  %arrayidx = getelementptr inbounds i8, i8* %tmp11, i64 %tmp10
  %tmp12 = load i8, i8* %arrayidx, align 1
  %conv = sext i8 %tmp12 to i32
  %idxprom = sext i32 %conv to i64
  %call = call i16** @__ctype_b_loc() #14
  %tmp13 = load i16*, i16** %call, align 8
  ; ...

是否有任何相关的编译标志可以实现? 或将删除它的任何LLVM通过??谢谢!

0 个答案:

没有答案