[PATCH] D93963: [GlobalISel][AMDGPU] Lower G_UMULO/G_SMULO

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 03:11:57 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:1828
+  unsigned SrcBitWidth = SrcTy.getScalarSizeInBits();
+  assert(WideTy.getScalarSizeInBits() >= 2 * SrcBitWidth);
+
----------------
If the wide type is at least twice as wide as the original type, then the widened multiply provably will not overflow, so you don't need the final "or".

If we want to support widening to a type that is less than twice as wide as the original type, then remove this assert and only do the final "or" if `WideTy.getScalarSizeInBits() >= 2 * SrcBitWidth`. But I'm not sure how you would write a test for that code path.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93963/new/

https://reviews.llvm.org/D93963



More information about the llvm-commits mailing list