Skip to content

Commit 7148a36

Browse files
committed
"User *U" -> "const User *U"
1 parent dba2b31 commit 7148a36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,8 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) {
782782

783783
/// A helper function to check if reassociating through an entry in the user
784784
/// chain would invalidate the GEP's nuw flag.
785-
static bool allowsPreservingNUW(User *U) {
786-
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
785+
static bool allowsPreservingNUW(const User *U) {
786+
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
787787
// Binary operations need to be effectively add nuw.
788788
auto Opcode = BO->getOpcode();
789789
if (Opcode == BinaryOperator::Or) {
@@ -798,7 +798,7 @@ static bool allowsPreservingNUW(User *U) {
798798
// Among the possible CastInsts, only trunc without nuw is a problem: If it
799799
// is distributed through an add nuw, wrapping may occur:
800800
// "add nuw trunc(a), trunc(b)" is more poisonous than "trunc(add nuw a, b)"
801-
if (TruncInst *TI = dyn_cast<TruncInst>(U))
801+
if (const TruncInst *TI = dyn_cast<TruncInst>(U))
802802
return TI->hasNoUnsignedWrap();
803803
return isa<CastInst>(U) || isa<ConstantInt>(U);
804804
}

0 commit comments

Comments
 (0)