Cost Model returning only cost of 1 or 0 never higer

For a project I need to know the rudimentary cost of an instruction and for that I want to use the CostModel class as defined in the CostModel.cpp file.

The idea is to get the cost of an instruction to calculate the Worst Case Execution Time (WCET) by traversing instructions one by one from an IR file. It does not have to be precise. However, as it turns out it is always returning 1 when choosing the RecipeThroughput option.

When I analyze the IR file with the -cost-model pass I am getting sometimes 2 for operands like fadd and fmul. (opt -analyze -targetlibinfo -cost-model inputFile.ll).

I have implemented the CostModel class separatly into my project. Basicly, I created a header for the CostModel class and gave it a different name like so:

I was hoping the cost-model analysis would simply run the CostModel class like I implemented it myself. Is this maybe not the case? How is it possible that I am only getting a value of 1 or 0 whilst the cost-model pass is showing different values?

I have also tried another method TargetTransformInfo but this also just returns 1 or 0 for each instruction.

Any help or information regarding the CostModel analysis pass would be appreciated. Currently I am stuck on this and cannot proceed without finding the cause.

Many thanks!