<div dir="ltr"><div dir="ltr"><div dir="ltr">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.<div><br></div><div>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.</div><div><br></div><div>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).</div><div><br></div><div>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: <a href="https://github.com/MWestenberg/EnergyAnalysis/blob/master/EnergyAnalysis/src/EnergyAnalysis/WCETCostModelAnalysis.h">https://github.com/MWestenberg/EnergyAnalysis/blob/master/EnergyAnalysis/src/EnergyAnalysis/WCETCostModelAnalysis.h</a></div><div><br></div><div>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? </div><div><br></div><div>I have also tried another method TargetTransformInfo but this also just returns 1 or 0 for each instruction.</div><div><br></div><div>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.</div><div><br></div><div>Many thanks!</div><div>Mark</div><div><br></div><div><br></div></div></div></div>