From fbe95dcfd2fbb3198f719bb62ecfa87b1c2b0c7f Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Wed, 5 Mar 2014 13:36:04 +0000 Subject: [PATCH] [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 --- llvm/docs/LangRef.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 9820fd8a5723..2d3b9d5b6f48 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -2792,9 +2792,9 @@ metadata types that refer to the same loop identifier metadata. 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 @@ -2809,21 +2809,22 @@ the loop identifier metadata node directly: .. code-block:: llvm outer.for.body: - ... + ... + %val1 = load i32* %arrayidx3, !llvm.mem.parallel_loop_access !2 + ... + br label %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 inner.for.end: ... - %0 = load i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !0 - ... - store i32 %0, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !0 + store i32 %val1, i32* %arrayidx4, !llvm.mem.parallel_loop_access !2 ... br i1 %exitcond, label %outer.for.end, label %outer.for.body, !llvm.loop !2