[all-commits] [llvm/llvm-project] 97215f: [CostModel] Express cost(urem) as cost(div+mul+sub...

sdesmalen-arm via All-commits all-commits at lists.llvm.org
Wed Jul 7 06:41:25 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 97215fe3f4d51977d7f4bbc65249ccfc0212a8ae
      https://github.com/llvm/llvm-project/commit/97215fe3f4d51977d7f4bbc65249ccfc0212a8ae
  Author: Sander de Smalen <sander.desmalen at arm.com>
  Date:   2021-07-07 (Wed, 07 Jul 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/test/Analysis/CostModel/AArch64/sve-remainder.ll
    M llvm/test/Analysis/CostModel/ARM/divrem.ll
    M llvm/test/Analysis/CostModel/X86/rem.ll

  Log Message:
  -----------
  [CostModel] Express cost(urem) as cost(div+mul+sub) when set to Expand.

The Legalizer expands the operations of urem/srem into a div+mul+sub or divrem
when those are legal/custom. This patch changes the cost-model to reflect that
cost.

Since there is no 'divrem' Instruction in LLVM IR, the cost of divrem
is assumed to be the same as div+mul+sub since the three operations will
need to be executed at runtime regardless.

Patch co-authored by David Sherwood (@david-arm)

Reviewed By: RKSimon, paulwalker-arm

Differential Revision: https://reviews.llvm.org/D103799




More information about the All-commits mailing list