From 24b9d74e70107a4517396d7fa940140e206398bf Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Mon, 13 May 2024 08:44:43 +0200 Subject: compcov int fix --- instrumentation/split-compares-pass.so.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'instrumentation/split-compares-pass.so.cc') diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc index 728ebc22..9b7bf256 100644 --- a/instrumentation/split-compares-pass.so.cc +++ b/instrumentation/split-compares-pass.so.cc @@ -1778,7 +1778,13 @@ bool SplitComparesTransform::runOnModule(Module &M) { auto op0 = CI->getOperand(0); auto op1 = CI->getOperand(1); + // has to valid operands if (!op0 || !op1) { continue; } + // has exactly one constant and one variable + int constants = 0; + if (dyn_cast(op0)) { ++constants; } + if (dyn_cast(op1)) { ++constants; } + if (constants != 1) { continue; } auto iTy1 = dyn_cast(op0->getType()); if (iTy1 && isa(op1->getType())) { -- cgit 1.4.1 From 0892a2245e9a7188e33c16444499c47942d1e56f Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Mon, 13 May 2024 20:28:50 +0200 Subject: float laf check --- instrumentation/split-compares-pass.so.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'instrumentation/split-compares-pass.so.cc') diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc index 9b7bf256..effafe50 100644 --- a/instrumentation/split-compares-pass.so.cc +++ b/instrumentation/split-compares-pass.so.cc @@ -266,8 +266,11 @@ bool SplitComparesTransform::simplifyFPCompares(Module &M) { /* this is probably not needed but we do it anyway */ if (TyOp0 != TyOp1) { continue; } - if (TyOp0->isArrayTy() || TyOp0->isVectorTy()) { continue; } + int constants = 0; + if (llvm::isa(op0)) { ++constants; } + if (llvm::isa(op1)) { ++constants; } + if (constants != 1) { continue; } fcomps.push_back(selectcmpInst); -- cgit 1.4.1