[all-commits] [llvm/llvm-project] 95fedf: [InstCombine] Handle non-canonical GEP index in in...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon May 2 08:56:18 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95fedfab6cfb82a2fe1010d266b1269425f5eb46
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-05-02 (Mon, 02 May 2022)

  Changed paths:
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    A llvm/test/Transforms/InstCombine/pr55228.ll

  Log Message:
  [InstCombine] Handle non-canonical GEP index in indexed compare fold (PR55228)

Normally the index type will already be canonicalized here, but
this is not guaranteed depending on visitation order. The code
was already accounting for a potentially needed sext, but a trunc
may also be needed.

Add a ConstantExpr::getSExtOrTrunc() helper method to make this
simpler. This matches the corresponding IRBuilder method in behavior.

Fixes https://github.com/llvm/llvm-project/issues/55228.

More information about the All-commits mailing list