[all-commits] [llvm/llvm-project] ef7aed: [InstCombine] Do not fold 'and (sext (ashr X, Shif...

Daniel Bertalan via All-commits all-commits at lists.llvm.org
Thu Jul 7 10:14:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ef7aed3e112b47641ca2704187d3701765a831ce
      https://github.com/llvm/llvm-project/commit/ef7aed3e112b47641ca2704187d3701765a831ce
  Author: Daniel Bertalan <dani at danielbertalan.dev>
  Date:   2022-07-07 (Thu, 07 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    A llvm/test/Transforms/InstCombine/pr56424.ll

  Log Message:
  -----------
  [InstCombine] Do not fold 'and (sext (ashr X, Shift)), C' if Shift < 0

The 'and (sext (ashr X, ShiftC)), C' --> 'lshr (sext X), ShiftC'
transformation would access out of bounds bits in APInt::getLowBitsSet
if the shift count was larger than X's bit width or if it was negative.

Fixes #56424




More information about the All-commits mailing list