[Beignet] [PATCH] GBE: correct the llvm.loop.unroll.enable meta.

Yang Rong rong.r.yang at intel.com
Mon Dec 26 07:13:07 UTC 2016


LLVM check has meta llvm.loop.unroll.enable and
llvm.loop.unroll.disable or not.
If llvm.loop.unroll.disable and llvm.loop.unroll.enable are both set,
llvm.loop.unroll.disable will override llvm.loop.unroll.enable.
---
 backend/src/llvm/llvm_unroll.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/backend/src/llvm/llvm_unroll.cpp b/backend/src/llvm/llvm_unroll.cpp
index 8a492d6..6a7b164 100644
--- a/backend/src/llvm/llvm_unroll.cpp
+++ b/backend/src/llvm/llvm_unroll.cpp
@@ -108,8 +108,10 @@ namespace gbe {
         LLVMContext &Context = L->getHeader()->getContext();
 #if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6
         SmallVector<Metadata *, 2> forceUnroll;
-        forceUnroll.push_back(MDString::get(Context, "llvm.loop.unroll.enable"));
-        forceUnroll.push_back(ConstantAsMetadata::get(ConstantInt::get(Type::getInt1Ty(Context), enable)));
+        if (enable)
+          forceUnroll.push_back(MDString::get(Context, "llvm.loop.unroll.enable"));
+        else
+          forceUnroll.push_back(MDString::get(Context, "llvm.loop.unroll.disable"));
         MDNode *forceUnrollNode = MDNode::get(Context, forceUnroll);
         SmallVector<Metadata *, 4> Vals;
         Vals.push_back(NULL);
-- 
2.7.4



More information about the Beignet mailing list