[PATCH] D151122: [GlobalISel] Check if ShiftAmt is greater then size of operand
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 22 13:16:08 PDT 2023
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1726
unsigned MinLeadingZeros = KB->getKnownZeroes(ExtSrc).countl_one();
- return MinLeadingZeros >= ShiftAmt;
+ unsigned SrcTySize = MRI.getType(ExtSrc).getSizeInBits();
+ return MinLeadingZeros >= ShiftAmt && ShiftAmt < SrcTySize;
----------------
Broken for vectors, getScalarSizeInBits
================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/combine-shl-from-extend-narrow.postlegal.mir:332
+---
+name: do_not_shl_s32_by_16_from_zext_s16
+tracksRegLiveness: true
----------------
Add a vector version. Also would be good to have one that couldn't be trivially constant folded
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151122/new/
https://reviews.llvm.org/D151122
More information about the llvm-commits
mailing list