From 5c224726169e421e95ec7f926f7808ff78cb05df Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 4 Jan 2021 18:20:02 +0100 Subject: cmplog fix --- instrumentation/cmplog-instructions-pass.cc | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'instrumentation/cmplog-instructions-pass.cc') diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc index 841ba0bd..154bec2b 100644 --- a/instrumentation/cmplog-instructions-pass.cc +++ b/instrumentation/cmplog-instructions-pass.cc @@ -249,11 +249,20 @@ bool CmpLogInstructions::hookInstrs(Module &M) { intTyOp0 = dyn_cast(V0->getType()); Value *V1 = IRB.CreateBitCast(op1, IntegerType::get(C, max_size)); intTyOp1 = dyn_cast(V1->getType()); - max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() + + if (intTyOp0 && intTyOp1) { + + max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() ? intTyOp0->getBitWidth() : intTyOp1->getBitWidth(); - args.push_back(V0); - args.push_back(V1); + args.push_back(V0); + args.push_back(V1); + + } else { + + max_size = 0; + + } } @@ -261,11 +270,16 @@ bool CmpLogInstructions::hookInstrs(Module &M) { intTyOp0 = dyn_cast(op0->getType()); intTyOp1 = dyn_cast(op1->getType()); - max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() - ? intTyOp0->getBitWidth() - : intTyOp1->getBitWidth(); - args.push_back(op0); - args.push_back(op1); + + if (intTyOp0 && intTyOp1) { + + max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() + ? intTyOp0->getBitWidth() + : intTyOp1->getBitWidth(); + args.push_back(op0); + args.push_back(op1); + + } } -- cgit 1.4.1