LGTM, thanks.

-----Original Message-----
From: Beignet [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Tuesday, March 17, 2015 1:26 PM
To: [email protected]
Cc: Luo, Xionghu
Subject: [Beignet] [patch v2] strip PointerCast for call instructions before 
use.

From: Luo Xionghu <[email protected]>

the callInst may contains bitcast instruction if the function's is
different with the decleration. strip the bitcast instruction to get
the real name.

v2: remove printf message.
Signed-off-by: Luo Xionghu <[email protected]>
---
 backend/src/llvm/llvm_bitcode_link.cpp | 3 +--
 backend/src/llvm/llvm_gen_backend.cpp  | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/backend/src/llvm/llvm_bitcode_link.cpp 
b/backend/src/llvm/llvm_bitcode_link.cpp
index 3bf9613..ebf4386 100644
--- a/backend/src/llvm/llvm_bitcode_link.cpp
+++ b/backend/src/llvm/llvm_bitcode_link.cpp
@@ -96,8 +96,7 @@ namespace gbe
             call->getCalledFunction()->getIntrinsicID() != 0)
           continue;
 
-        Value *Callee = call->getCalledValue();
-        const std::string fnName = Callee->getName();
+        std::string fnName = 
call->getCalledValue()->stripPointerCasts()->getName();
 
         if (!MFS.insert(fnName).second) {
           continue;
diff --git a/backend/src/llvm/llvm_gen_backend.cpp 
b/backend/src/llvm/llvm_gen_backend.cpp
index 773300b..bf03a13 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -2628,7 +2628,7 @@ namespace gbe
       }
     }
     // Get the name of the called function and handle it
-    const std::string fnName = Callee->getName();
+    const std::string fnName = Callee->stripPointerCasts()->getName();
     auto genIntrinsicID = intrinsicMap.find(fnName);
     switch (genIntrinsicID) {
       case GEN_OCL_GET_GROUP_ID0:
@@ -3018,7 +3018,7 @@ namespace gbe
       } else {
         // Get the name of the called function and handle it
         Value *Callee = I.getCalledValue();
-        const std::string fnName = Callee->getName();
+        const std::string fnName = Callee->stripPointerCasts()->getName();
         auto genIntrinsicID = intrinsicMap.find(fnName);
 
         // Get the function arguments
-- 
1.9.1

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to