about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--instrumentation/cmplog-routines-pass.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/instrumentation/cmplog-routines-pass.cc b/instrumentation/cmplog-routines-pass.cc
index 854492b1..5dd5dc39 100644
--- a/instrumentation/cmplog-routines-pass.cc
+++ b/instrumentation/cmplog-routines-pass.cc
@@ -283,14 +283,21 @@ bool CmpLogRoutines::hookRtns(Module &M) {
                            FT->getParamType(0)->isPointerTy() &&
                            FT->getParamType(2)->isIntegerTy();
           if (isPtrRtnN) {
-            auto intTyOp = dyn_cast<IntegerType>(callInst->getArgOperand(2)->getType());
+
+            auto intTyOp =
+                dyn_cast<IntegerType>(callInst->getArgOperand(2)->getType());
             if (intTyOp) {
-              if (intTyOp->getBitWidth() != 32 && intTyOp->getBitWidth() != 64) {
+
+              if (intTyOp->getBitWidth() != 32 &&
+                  intTyOp->getBitWidth() != 64) {
+
                 isPtrRtnN = false;
+
               }
+
             }
-          }
 
+          }
 
           bool isMemcmp =
               (!FuncName.compare("memcmp") || !FuncName.compare("bcmp") ||
@@ -478,7 +485,10 @@ bool CmpLogRoutines::hookRtns(Module &M) {
     std::vector<Value *> args;
     Value *              v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy);
     Value *              v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy);
-    Value *              v3Pcasted = IRB.CreateTruncOrBitCast(v3P, Int64Ty);
+    Value *              v3Pbitcast = IRB.CreateBitCast(
+        v3P, IntegerType::get(C, v3P->getType()->getPrimitiveSizeInBits()));
+    Value *v3Pcasted =
+        IRB.CreateIntCast(v3Pbitcast, IntegerType::get(C, 64), false);
     args.push_back(v1Pcasted);
     args.push_back(v2Pcasted);
     args.push_back(v3Pcasted);
@@ -533,7 +543,10 @@ bool CmpLogRoutines::hookRtns(Module &M) {
     std::vector<Value *> args;
     Value *              v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy);
     Value *              v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy);
-    Value *              v3Pcasted = IRB.CreateTruncOrBitCast(v3P, Int64Ty);
+    Value *              v3Pbitcast = IRB.CreateBitCast(
+        v3P, IntegerType::get(C, v3P->getType()->getPrimitiveSizeInBits()));
+    Value *v3Pcasted =
+        IRB.CreateIntCast(v3Pbitcast, IntegerType::get(C, 64), false);
     args.push_back(v1Pcasted);
     args.push_back(v2Pcasted);
     args.push_back(v3Pcasted);