Skip to content

Commit 443ee1d

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

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
@@ -2726,9 +2726,10 @@ SDValue DAGCombiner::visitPTRADD(SDNode *N) {
27262726
DAG.getMachineFunction().getFunction(), PtrVT))
27272727
return SDValue();
27282728

2729-
if (N0.getOpcode() == ISD::PTRADD && N1.getOpcode() == ISD::Constant) {
2729+
if (N0.getOpcode() == ISD::PTRADD && isa<ConstantSDNode>(N1)) {
27302730
// Fold (ptradd (ptradd GA, v), c) -> (ptradd (ptradd GA, c) v) with
27312731
// global address GA and constant c, such that c can be folded into GA.
2732+
// TODO: Support constant vector splats.
27322733
SDValue GAValue = N0.getOperand(0);
27332734
if (const GlobalAddressSDNode *GA =
27342735
dyn_cast<GlobalAddressSDNode>(GAValue)) {

0 commit comments

Comments
 (0)