[LLVMdev] Parallel Loop Metadata
Andrew Trick
atrick at apple.com
Sun Feb 17 12:32:25 PST 2013
On Feb 11, 2013, at 2:58 PM, Tobias Grosser <tobias at grosser.es> wrote:
> On 02/11/2013 10:31 PM, Nadav Rotem wrote:
>> Now that we have a better understanding of the proposal for using per-instruction metadata, I think that we need to revisit the "single metedata" approach (Pekka's original suggestion).
>
> Following Andrew's comments we understood that Sebastian's proposal causes issues with inlining and unrolling. It seems we all agree that his proposal is not an option we can go with.
Work is well on it's way now, and that's great. But just so people don't get the wrong impression from this thread. I'm not aware of any correctness issue with the "single metadata" approach. Inlining seems to work fine for me. Here's a hacky little example to see what I mean.
define void @wrapper(i32* %arg) {
%1 = call i32 @loop(i32* %arg)
ret void
}
define i32 @loop(i32* %a) {
entry:
br label %loop
loop: ; preds = %loop, %entry
%p = phi i32* [%a,%entry], [%p1, %loop]
%p1 = getelementptr i32* %p, i64 1
%v = load i32* %p
%cond = icmp eq i32 %v, 0
br i1 %cond, label %loop, label %exit, !metadata !{i32* %p, metadata !0}
exit: ; preds = %loop
ret i32 %v
}
!0 = metadata !{metadata !"loop"}
$ opt -inline -S <
define void @wrapper(i32* %arg) {
br label %loop.i
loop.i: ; preds = %loop.i, %0
%p.i = phi i32* [ %arg, %0 ], [ %p1.i, %loop.i ]
%p1.i = getelementptr i32* %p.i, i64 1
%v.i = load i32* %p.i
%cond.i = icmp eq i32 %v.i, 0
br i1 %cond.i, label %loop.i, label %loop.exit, !metadata !{i32* %p.i, metadata !0}
loop.exit: ; preds = %loop.i
ret void
}
!0 = metadata !{metadata !"loop"}
---
Unrolling OTOH should be aware of and preserve any loop metadata.
-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130217/28b8e6b5/attachment.html>
More information about the llvm-dev
mailing list