[PATCH] D99481: [InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 18 10:01:15 PDT 2021
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:293
+ if (countTrailingZeros(ElementSize) != 0) {
+ Value *Mask = ConstantInt::get(Idx->getType(), -1);
+ Mask = Builder.CreateLShr(Mask, countTrailingZeros(ElementSize));
----------------
Using "-1" like this won't sign-extend correctly if anyone ever uses a pointer type wider than 64 bits.
There are a few ways to solve this; you can use ConstantInt::getSigned(), or APInt::getLowBitsSet().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99481/new/
https://reviews.llvm.org/D99481
More information about the llvm-commits
mailing list