[PATCH] D69960: [ConstantRange] Add `ushl_sat()`/`sshl_sat()` methods.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 14:26:17 PST 2019
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/IR/ConstantRange.cpp:1352
+ APInt NewL = Min.sshl_sat(isAllNonNegative() ? ShAmtMin : ShAmtMax);
+ APInt NewU = Max.sshl_sat(isAllNegative() ? ShAmtMin : ShAmtMax) + 1;
+ return getNonEmpty(std::move(NewL), std::move(NewU));
----------------
Mild preference for using `Min.isNonNegative()` and `Max.isNegative()` here, because it makes the relationship to the shifted value clear. Also fine as-is though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69960/new/
https://reviews.llvm.org/D69960
More information about the llvm-commits
mailing list