Compiler construction 如何在FileCheck测试中允许函数重新排序?

Compiler construction 如何在FileCheck测试中允许函数重新排序?,compiler-construction,llvm,Compiler Construction,Llvm,我想为LLVM过程编写一个LIT测试,它可以在IR中重新排序函数定义。我想对重新排序的几个函数的内容做出断言 ; (a) need to match "define internal void @foo()" ; (b) need to match "call void @bar()" define internal void @foo() { call void @bar() ret void } ; (c) need to match

我想为LLVM过程编写一个LIT测试,它可以在IR中重新排序函数定义。我想对重新排序的几个函数的内容做出断言

; (a) need to match "define internal void @foo()"
; (b) need to match "call void @bar()"
define internal void @foo() {
    call void @bar()
    ret void
}

; (c) need to match "define internal void @bar()"
; (d) need to match "call void @baz()"
define internal void @bar() {
    call void @baz()
    ret void
}

; (e) need to match "define internal void @baz()"
define internal void @baz() {
    ret void
}
我想实现的依赖关系图如下:

a  c  e
|  |
b  d

这听起来像是一个,也许你可以重新措辞或详细阐述?你是对的。我仍然想问一个关于任意DAG的更一般的问题,但我对FileCheck还是新手,所以希望学习更好地使用它能帮助我更清楚地问这个问题。我编辑了这个问题来询问我的具体情况。
CHECK-DAG
有用吗?现在这个问题好多了。我以前根本不知道这件事的来龙去脉。通过对测试进行塑形,从而可以推断结果顺序,也就是说,即使顺序在一般情况下不容易预测,您也选择了可以预测的测试用例,从而解决了一些类似的问题。(注意,在许多情况下,即使顺序没有意义,也希望有一个稳定的顺序,因为如果顺序是稳定的,您可以将今天的IR与上周的IR区分开来,只得到实质性的更改。很好的调试功能。)顺序是稳定的,所以我最终只是在结果顺序中进行断言。不过,我仍然希望得到我所问问题的答案,所以我将保留这个问题。