[all-commits] [llvm/llvm-project] 44714f: [InstCombine] Fold afn powi(2.0, x) to ldexp(1.0, ...

jpwang via All-commits all-commits at lists.llvm.org
Tue Jun 9 08:41:11 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 44714f90d8e203b9227613c52e7794b58b78454e
      https://github.com/llvm/llvm-project/commit/44714f90d8e203b9227613c52e7794b58b78454e
  Author: jpwang <jpwang at smail.nju.edu.cn>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/powi.ll

  Log Message:
  -----------
  [InstCombine] Fold afn powi(2.0, x) to ldexp(1.0, x) (#202114)

This PR adds a conservative InstCombine fold `powi(2.0, x) -> ldexp(1.0,
x)` with an `afn` flag.
This together with the existing fold `y * ldexp(1.0, x) -> ldexp(y, x)`
makes it possible to optimize cases like `y * __builtin_powif(2.0f, x)`
under fast-math.

The fold is intentionally limited to cases where the base is exactly 2.0
for now to make it simple.

Fixes #200654



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