Skip to content

Commit 1070abb

Browse files
committed
Remove isa assert, fix comment typo
1 parent 0cdb310 commit 1070abb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,8 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) {
783783
/// A helper function to check if reassociating through an entry in the user
784784
/// chain would invalidate the GEP's nuw flag.
785785
static bool allowsPreservingNUW(User *U) {
786-
assert(isa<BinaryOperator>(U) || isa<CastInst>(U) || isa<ConstantInt>(U));
787786
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(U)) {
788-
// Binary operations needd to be effectively add nuw.
787+
// Binary operations need to be effectively add nuw.
789788
auto Opcode = BO->getOpcode();
790789
if (Opcode == BinaryOperator::Or) {
791790
// Ors are only considered here if they are disjoint. The addition that
@@ -801,7 +800,7 @@ static bool allowsPreservingNUW(User *U) {
801800
// "add nuw trunc(a), trunc(b)" is more poisonous than "trunc(add nuw a, b)"
802801
if (TruncInst *TI = dyn_cast<TruncInst>(U))
803802
return TI->hasNoUnsignedWrap();
804-
return true;
803+
return isa<CastInst>(U) || isa<ConstantInt>(U);
805804
}
806805

807806
Value *ConstantOffsetExtractor::Extract(Value *Idx, GetElementPtrInst *GEP,

0 commit comments

Comments
 (0)