<html><body><p>Alexey,<br><br>Thanks for the pointer. I've updated the patch using<br><font size="4">CGF.ConvertTypeForMem(CGM.getContext().BoolTy);</font><br>to get the type for 'bool'.<br><br>On my machine it returns i8. The compiler produces code for a simple OpenMP program that links and seems to run fine on the GPU with my runtime.<br><br>I also compiled the following C++ program to get the IR shown below:<br><br>bool test() {<br> return true;<br>}<br><br>; Function Attrs: noinline nounwind<br>define zeroext i1 @_Z4testv() #0 {<br>entry: <br> ret i1 true<br>}<br><br>For this program you can see i1 being generated. I'm not quite sure what the difference is...<br><br>Regards,<br>Arpith<br><br><img width="16" height="16" src="cid:1__=8FBB0A30DFC9989F8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Alexey Bataev ---01/09/2017 08:47:10 AM---Arpith, I'm afraid that bool type is translated to i8 or ev"><font color="#424282">Alexey Bataev ---01/09/2017 08:47:10 AM---Arpith, I'm afraid that bool type is translated to i8 or even to i32 type rather than to i1. I belie</font><br><br><font size="2" color="#5F5F5F">From: </font><font size="2">Alexey Bataev <a.bataev@hotmail.com></font><br><font size="2" color="#5F5F5F">To: </font><font size="2">"reviews+D28145+public+d89a609fe244de18@reviews.llvm.org" <reviews+D28145+public+d89a609fe244de18@reviews.llvm.org></font><br><font size="2" color="#5F5F5F">Cc: </font><font size="2">Arpith C Jacob/Watson/IBM@IBMUS, Samuel F Antao/Watson/IBM@IBMUS, Carlo Bertolli/Watson/IBM@IBMUS, "kkwli0@gmail.com" <kkwli0@gmail.com>, Kevin K O'Brien/Watson/IBM@IBMUS, "gheorghe-teod.bercea@ibm.com" <gheorghe-teod.bercea@ibm.com>, "tra@google.com" <tra@google.com>, "jholewinski@nvidia.com" <jholewinski@nvidia.com>, "cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org></font><br><font size="2" color="#5F5F5F">Date: </font><font size="2">01/09/2017 08:47 AM</font><br><font size="2" color="#5F5F5F">Subject: </font><font size="2">Re: [PATCH] D28145: [OpenMP] Basic support for a parallel directive in a target region on an NVPTX device.</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt>Arpith, I'm afraid that bool type is translated to i8 or even to i32 type rather than to i1. I believe you'd better to use CGF.ConvertTypeForMem(Context.getBoolType())to get the correct return type for bool rather than simply i1. You'd better to check how bool(...) function type is converted to LLVM IR. <br><br>Best regards,<br>Alexey Bataev<br><br>> 9 янв. 2017 г., в 15:09, Arpith Jacob via Phabricator <reviews@reviews.llvm.org> написал(а):<br>> <br>> arpith-jacob marked 2 inline comments as done.<br>> arpith-jacob added inline comments.<br>> <br>> <br>> ================<br>> Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:365<br>> + llvm::FunctionType *FnTy =<br>> + llvm::FunctionType::get(llvm::Type::getInt1Ty(CGM.getLLVMContext()),<br>> + TypeParams, /*isVarArg*/ false);<br>> ----------------<br>> ABataev wrote:<br>>> Does it really return I1 type? Or I8?<br>> Alexey, the runtime function is called by every worker thread. It returns a 'bool' that indicates if the thread has been activated in the parallel region, which is why I used an Int1Ty. Please let me know if you see problems with this. Thanks.<br>> <br>> <br>> </tt><tt><a href="https://reviews.llvm.org/D28145">https://reviews.llvm.org/D28145</a></tt><tt><br>> <br>> <br>> <br><br></tt><br><br><BR>
</body></html>