[PATCH] D119740: [InstructionSimplify][FIX] Handle bit widths in the presence of AS-casts

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 08:04:07 PST 2022


jdoerfert added a comment.

In D119740#3322389 <https://reviews.llvm.org/D119740#3322389>, @nikic wrote:

> Does https://github.com/llvm/llvm-project/commit/f35af77573d9e80bf6e61b3fdd20fe55191e962f fix your original problem?

It makes it easier to fix but without testing it I would not assume the issue is gone.
The strip calls can still yield constants with different bit-width as they are matched to the bit-width of the resulting value.
So LHS/RHS that come out of the strip call can have different types and address spaces, and the constant offsets can have different bit-widths.

If we always return the constants with bit-widths matching the inputs (which I do here), the only remaining problem is that we call `stripPointerCasts` first, which causes the LHS/RHS to be "not in sync" when we call stripAndAccumulate. (see my comment in the code).



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2577
   LHS = LHS->stripPointerCasts();
   RHS = RHS->stripPointerCasts();
 
----------------
^Here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119740



More information about the llvm-commits mailing list