[PATCH] D54742: [CodeMetrics] Don't let extends of i1 be free.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 19 17:43:23 PST 2018


chandlerc added a comment.

In D54742#1335204 <https://reviews.llvm.org/D54742#1335204>, @hfinkel wrote:

> In D54742#1334276 <https://reviews.llvm.org/D54742#1334276>, @jonpa wrote:
>
> > ping!  @eastig? @RKSimon? @chandlerc?
>
>
>
>
> > , CostModel will not call getUserCost(), but instead getCastInstrCost() for the zext. So my patch does not affect this test, and I don't know how to make a direct test that calls getUserCost() like you propose.
>
> Sure it does. Run the -cost-model analysis with -cost-kind=code-size and it will call getUserCost(). Note the implementation of:
>
>   int getInstructionCost(const Instruction *I, enum TargetCostKind kind) const {
>     switch (kind){
>     case TCK_RecipThroughput:
>       return getInstructionThroughput(I);
>   
>     case TCK_Latency:
>       return getInstructionLatency(I);
>   
>     case TCK_CodeSize:
>       return getUserCost(I);
>     }
>     llvm_unreachable("Unknown instruction cost kind");
>   }


I also gave an example that does this in my suggestion.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54742/new/

https://reviews.llvm.org/D54742





More information about the llvm-commits mailing list