[all-commits] [llvm/llvm-project] 457e5b: [InstCombine] Use context instruction in divceil o...

Gurvir Dhillon via All-commits all-commits at lists.llvm.org
Wed Sep 30 03:15:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 457e5bad6d6b7012a123a9272c9deb83dc3d6c04
      https://github.com/llvm/llvm-project/commit/457e5bad6d6b7012a123a9272c9deb83dc3d6c04
  Author: Gurvir Dhillon <gman.dhillon at gmail.com>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/divceil.ll

  Log Message:
  -----------
  [InstCombine] Use context instruction in divceil overflow check (#227158)

Divceil optimization only happens if we can prove x + y - 1 does not
overflow. Originally, a SimplifyQuery with no context instruction was
passed to checkDivCeilNUW which made it so that the optimization never
happened if the bound came from an assume. This meant that even when an
assume proved that x + y - 1 did not overflow, the optimization did not
happen.

This change passes SQ.getWithInstruction(&I) so the range of x is
computed at the add being folded, and assumes that apply there are used
when deciding whether we can fold.

Fixes #220849

AI Disclosure: I used Claude to help explain LLVM concepts while I was
trying to understand the problem. It also walked me through syntax,
helper functions that I should utilize, good test cases, and general
formatting for things like test case comments.



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