[all-commits] [llvm/llvm-project] 4cdcf3: [InstCombine] Fold `(trunc nuw A to i1) == (trunc ...

Veera via All-commits all-commits at lists.llvm.org
Fri Mar 28 05:33:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4cdcf3b19302d8f337b5607d6b9df170f577dc70
      https://github.com/llvm/llvm-project/commit/4cdcf3b19302d8f337b5607d6b9df170f577dc70
  Author: Veera <32646674+veera-sivarajan at users.noreply.github.com>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-of-trunc-ext.ll

  Log Message:
  -----------
  [InstCombine] Fold `(trunc nuw A to i1) == (trunc nuw B to i1)` to `A == B` (#133368)

Fixes #133344

Proof: https://alive2.llvm.org/ce/z/X3Uh23 

InstCombine couldn't optimize `i1` because `canonicalizeICmpBool()` was
transforming the comparison into bitwise operations before
`foldICmpTruncWithTruncOrExt()` was called.

This PR solves the ordering issue by placing
`foldICmpTruncWithTruncOrExt()` before `canonicalizeICmpBool()`.

I believe this will not cause any regressions since all tests are
passing.



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