[all-commits] [llvm/llvm-project] df4e0b: [NFC][ConstantFold] Check getAggregateElement befo...

Stephen via All-commits all-commits at lists.llvm.org
Tue Aug 3 21:52:30 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df4e0beaeb0cba052e51094ff8d9447bea11fe62
      https://github.com/llvm/llvm-project/commit/df4e0beaeb0cba052e51094ff8d9447bea11fe62
  Author: Senran Zhang <zsrkmyn at gmail.com>
  Date:   2021-08-03 (Tue, 03 Aug 2021)

  Changed paths:
    M llvm/lib/IR/ConstantFold.cpp

  Log Message:
  -----------
  [NFC][ConstantFold] Check getAggregateElement before getSplatValue call

Constant::getSplatValue has O(N) time complexity in the worst case,
where N is the # of elements in a vector. So we call
Constant::getAggregateElement first and return earlier if possible to
avoid unnecessary getSplatValue calls.

Reviewed By: MaskRay

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




More information about the All-commits mailing list