]> granicus.if.org Git - clang/commit
Use CGLoopInfo to emit metadata for loop hint pragmas.
authorTyler Nowicki <tyler.nowicki@gmail.com>
Mon, 27 Jul 2015 20:10:20 +0000 (20:10 +0000)
committerTyler Nowicki <tyler.nowicki@gmail.com>
Mon, 27 Jul 2015 20:10:20 +0000 (20:10 +0000)
commit33ecde5538b976253e5adf45442e7f0b4a3d21bf
tree79818a98e9acdf45cbe8f35c4041b7942301a340
parent1dcf333250f807ff367394b8a0e88a32981c6fff
Use CGLoopInfo to emit metadata for loop hint pragmas.

When ‘#pragma clang loop vectorize(assume_safety)’ was specified on a loop other loop hints were lost. The problem is that CGLoopInfo attaches metadata differently than EmitCondBrHints in CGStmt. For do-loops CGLoopInfo attaches metadata to the br in the body block and for while and for loops, the inc block. EmitCondBrHints on the other hand always attaches data to the br in the cond block. When specifying assume_safety CGLoopInfo emits an empty llvm.loop metadata shadowing the metadata in the cond block. Loop transformations like rotate and unswitch would then eliminate the cond block and its non-empty metadata.

This patch unifies both approaches for adding metadata and modifies the existing safety tests to include non-assume_safety loop hints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243315 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGLoopInfo.cpp
lib/CodeGen/CGLoopInfo.h
lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/pragma-loop-safety.cpp
test/CodeGenCXX/pragma-loop.cpp
test/CodeGenCXX/pragma-unroll.cpp