diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h index 993c7feb4f286..0c6ebf87b2923 100644 --- a/llvm/include/llvm/Analysis/ValueTracking.h +++ b/llvm/include/llvm/Analysis/ValueTracking.h @@ -791,8 +791,7 @@ bool onlyUsedByLifetimeMarkers(const Value *V); /// droppable instructions. bool onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V); -/// Return true if the instruction doesn't potentially cross vector lanes. This -/// is useful to make GVN-replacements for vector types. +/// Return true if the instruction doesn't potentially cross vector lanes. bool isNotCrossLaneOperation(const Instruction *I); /// Return true if the instruction does not have any effects besides diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index b2e40bee2e0f6..d08be1e55c853 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4343,9 +4343,9 @@ static Value *simplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp, if (isa(I)) return nullptr; + // For vector types, the simplification must hold per-lane, so forbid + // potentially cross-lane operations like shufflevector. if (Op->getType()->isVectorTy() && !isNotCrossLaneOperation(I)) - // For vector types, the simplification must hold per-lane, so forbid - // potentially cross-lane operations like shufflevector. return nullptr; // Don't fold away llvm.is.constant checks based on assumptions.