[LangRef] Improve llvm.mem.parallel_loop_access example

The following changes have been applied:

  - Removed 'align 4'. We can simplify this away, as it does not provide useful
    information in the example.
  - Use named instructions instead of '%0'. This is nicer, but more importantly
    this makes the IR valid. Before we had two assignments to %0 in a single
    example.
  - Add a missing branch instruction to make the loop structure clear.
  - Move one access into outer.for.body to make it not look that empty.
  - The statments that are only in the outer loop body should not reference the
    inner loop metadata, but only the outer loop. Only statements in both loops
    should reference both surrounding loops.
  - Rename the array indexes to make them all independent. Before there were
    identical array indexes in the inner and the outer loop. We want to
    avoid this special case as it may lead to confusion.

llvm-svn: 202973
This commit is contained in:
Tobias Grosser 2014-03-05 13:36:04 +00:00
parent 6dece3c99f
commit fbe95dcfd2
1 changed files with 9 additions and 8 deletions

View File

@ -2792,9 +2792,9 @@ metadata types that refer to the same loop identifier metadata.
for.body: for.body:
... ...
%0 = load i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !0 %val0 = load i32* %arrayidx, !llvm.mem.parallel_loop_access !0
... ...
store i32 %0, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !0 store i32 %val0, i32* %arrayidx1, !llvm.mem.parallel_loop_access !0
... ...
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
@ -2809,21 +2809,22 @@ the loop identifier metadata node directly:
.. code-block:: llvm .. code-block:: llvm
outer.for.body: outer.for.body:
... ...
%val1 = load i32* %arrayidx3, !llvm.mem.parallel_loop_access !2
...
br label %inner.for.body
inner.for.body: inner.for.body:
... ...
%0 = load i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !0 %val0 = load i32* %arrayidx1, !llvm.mem.parallel_loop_access !0
... ...
store i32 %0, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !0 store i32 %val0, i32* %arrayidx2, !llvm.mem.parallel_loop_access !0
... ...
br i1 %exitcond, label %inner.for.end, label %inner.for.body, !llvm.loop !1 br i1 %exitcond, label %inner.for.end, label %inner.for.body, !llvm.loop !1
inner.for.end: inner.for.end:
... ...
%0 = load i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !0 store i32 %val1, i32* %arrayidx4, !llvm.mem.parallel_loop_access !2
...
store i32 %0, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !0
... ...
br i1 %exitcond, label %outer.for.end, label %outer.for.body, !llvm.loop !2 br i1 %exitcond, label %outer.for.end, label %outer.for.body, !llvm.loop !2