File tree 1 file changed +2
-3
lines changed
llvm/lib/Transforms/Scalar
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -783,9 +783,8 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) {
783
783
// / A helper function to check if reassociating through an entry in the user
784
784
// / chain would invalidate the GEP's nuw flag.
785
785
static bool allowsPreservingNUW (User *U) {
786
- assert (isa<BinaryOperator>(U) || isa<CastInst>(U) || isa<ConstantInt>(U));
787
786
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.
789
788
auto Opcode = BO->getOpcode ();
790
789
if (Opcode == BinaryOperator::Or) {
791
790
// Ors are only considered here if they are disjoint. The addition that
@@ -801,7 +800,7 @@ static bool allowsPreservingNUW(User *U) {
801
800
// "add nuw trunc(a), trunc(b)" is more poisonous than "trunc(add nuw a, b)"
802
801
if (TruncInst *TI = dyn_cast<TruncInst>(U))
803
802
return TI->hasNoUnsignedWrap ();
804
- return true ;
803
+ return isa<CastInst>(U) || isa<ConstantInt>(U) ;
805
804
}
806
805
807
806
Value *ConstantOffsetExtractor::Extract (Value *Idx, GetElementPtrInst *GEP,
You can’t perform that action at this time.
0 commit comments