[all-commits] [llvm/llvm-project] e2d140: [TTI] Add isExpensiveToSpeculativelyExecute wrapper

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Sat Sep 3 05:12:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2d140e9c33739032db40b18a019ece4fb3f687a
      https://github.com/llvm/llvm-project/commit/e2d140e9c33739032db40b18a019ece4fb3f687a
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-09-03 (Sat, 03 Sep 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetTransformInfo.h
    M llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
    M llvm/lib/Analysis/TargetTransformInfo.cpp
    M llvm/lib/CodeGen/CodeGenPrepare.cpp

  Log Message:
  -----------
  [TTI] Add isExpensiveToSpeculativelyExecute wrapper

CGP uses a raw `getInstructionCost(I, TargetTransformInfo::TCK_SizeAndLatency) >= TCC_Expensive` check to see if its better to move an expensive instruction used in a select behind a branch instead.

This is causing issues with upcoming improvements to TCK_SizeAndLatency costs on X86 as we need to use TCK_SizeAndLatency as an uop count (so its compatible with various target-specific buffer sizes - see D132288), but we can have instructions that have a low TCK_SizeAndLatency value but should still be treated as 'expensive' (FDIV for example) - by adding a isExpensiveToSpeculativelyExecute wrapper we can keep the current behaviour but still add an x86 override in a future patch when the cost tables are updated to compensate.




More information about the All-commits mailing list