LLVM全局指令选择失败

LLVM全局指令选择失败,llvm,llvm-ir,Llvm,Llvm Ir,我正在尝试使用全局指令选择运行llc,不幸的是,它在任何移位指令上都失败(例如shl)。 下面是如何使用llc-global isel=true-filetype=asm sample.ll来表示它: define i64 @test_advance(i1 %nullify, i64 %iaoq) { entry: %cache = alloca i64 store i64 %iaoq, i64* %cache br i1 %nullify, label %cond_tr

我正在尝试使用全局指令选择运行
llc
,不幸的是,它在任何移位指令上都失败(例如
shl
)。 下面是如何使用llc-global isel=true-filetype=asm sample.ll来表示它:

define i64 @test_advance(i1 %nullify, i64 %iaoq) {
entry:
    %cache = alloca i64
    store i64 %iaoq, i64* %cache
    br i1 %nullify, label %cond_true, label %cond_false

cond_false:
    %iaoq.1 = load i64, i64* %cache
    %iaoq.2 = add i64 %iaoq.1, 4
    %iaoq.x = shl i64 %iaoq.2, 13
    store i64 %iaoq.x, i64* %cache
    br label %next_insn

cond_true:
    %iaoq.3 = load i64, i64* %cache
    %iaoq.4 = add i64 %iaoq.3, 8
    store i64 %iaoq.4, i64* %cache
    br label %after_next_insn

next_insn:
    %iaoq.5 = load i64, i64* %cache
    %iaoq.6 = add i64 %iaoq.5, 4
    store i64 %iaoq.6, i64* %cache
    br label %after_next_insn

after_next_insn:
  %res = load i64, i64* %cache
  ret i64 %res
}
为什么会有如此奇怪的行为?轮班有什么奇怪的?我的平台是x86

编辑

在发布版本70中,这个问题得到了解决,不幸的是,全球isel无法应对uadd U的合法化和溢出:

define i64 @test_advance(i1 %nullify, i64 %iaoq) {
entry:
    %0 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %iaoq, i64 %iaoq)
    %sum_64_7949 = extractvalue { i64, i1 } %0, 0
    ret i64 %sum_64_7949
}

; Function Attrs: nounwind readnone speculatable
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) #0
它会得到相同的错误:

LLVM ERROR: unable to legalize instruction: %3:_(s64), %4:_(s1) = G_UADDE %1:_, %1:_, %5:_ (in function: test_advance)

这似乎是一个bug(svn trunk上不存在),你能更新你正在使用的llc版本吗?从最新版本_70构建,这个问题已经解决了,但新出现了。。。