Skip to content

Commit cb86ff7

Browse files
committed
Use isa<ConstantSDNode> instead of checking the opcode and add a TODO to support vector splats
1 parent a8fdd2e commit cb86ff7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2719,9 +2719,10 @@ SDValue DAGCombiner::visitPTRADD(SDNode *N) {
27192719
DAG.getMachineFunction().getFunction(), PtrVT))
27202720
return SDValue();
27212721

2722-
if (N0.getOpcode() == ISD::PTRADD && N1.getOpcode() == ISD::Constant) {
2722+
if (N0.getOpcode() == ISD::PTRADD && isa<ConstantSDNode>(N1)) {
27232723
// Fold (ptradd (ptradd GA, v), c) -> (ptradd (ptradd GA, c) v) with
27242724
// global address GA and constant c, such that c can be folded into GA.
2725+
// TODO: Support constant vector splats.
27252726
SDValue GAValue = N0.getOperand(0);
27262727
if (const GlobalAddressSDNode *GA =
27272728
dyn_cast<GlobalAddressSDNode>(GAValue)) {

0 commit comments

Comments
 (0)