[all-commits] [llvm/llvm-project] e80f32: [CodeGenPrepare] Use Instruction::comesBefore inst...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Mon Apr 6 21:02:38 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e80f32fd20bf15b4515e868962ace7b34b477d09
      https://github.com/llvm/llvm-project/commit/e80f32fd20bf15b4515e868962ace7b34b477d09
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-04-06 (Mon, 06 Apr 2026)

  Changed paths:
    M llvm/lib/CodeGen/CodeGenPrepare.cpp

  Log Message:
  -----------
  [CodeGenPrepare] Use Instruction::comesBefore instead of manual ordering (#190485)

After #172329, we noticed that some sources compiled with MSan take
1000x longer to compile. This is caused by quadratic complexity in
tryToSinkFreeOperands, which can be called on a significant number
of instructions within huge basic blocks.

This inefficiency was introduced in 9cfa9b4, which manually iterates
and creates a DenseMap of entire basic blocks for each interesting
instruction.

This patch avoids the manual ordering by using
Instruction::comesBefore(), which provides the exact same
ordering much more efficiently.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list