[all-commits] [llvm/llvm-project] 4041c4: [InstCombine] Update predicate when canonicalizing...

Ricky Zhou via All-commits all-commits at lists.llvm.org
Tue Apr 26 14:36:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4041c44853588c1e4918ec4a160c053cf08432b5
      https://github.com/llvm/llvm-project/commit/4041c44853588c1e4918ec4a160c053cf08432b5
  Author: Ricky Zhou <ricky+llvm at rzhou.org>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll

  Log Message:
  -----------
  [InstCombine] Update predicate when canonicalizing comparisons in canonicalizeClampLike.

canonicalizeClampLike canonicalizes the ule/ugt comparisons to ult/uge,
respectively. However, it does not update the variable holding the
comparison predicate type after doing this. Later code fails to handle
the non-canonical predicate type (specifically, the swap of
ThresholdLowIncl and ThresholdHighExcl when Pred0 has been canonicalized
from ugt to uge). This leads to the miscompile reported in PR53252. Fix
this by updating the comparison predicate after canonicalizing.

Fixes #53252

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




More information about the All-commits mailing list