Index: lib/Analysis/CFLGraph.h =================================================================== --- lib/Analysis/CFLGraph.h +++ lib/Analysis/CFLGraph.h @@ -510,19 +510,31 @@ void visitConstantExpr(ConstantExpr *CE) { switch (CE->getOpcode()) { - case Instruction::GetElementPtr: { - auto GEPOp = cast(CE); - visitGEP(*GEPOp); - break; - } - case Instruction::PtrToInt: { - auto *Ptr = CE->getOperand(0); - addNode(Ptr, getAttrEscaped()); + case Instruction::Add: + case Instruction::Sub: + case Instruction::FSub: + case Instruction::Mul: + case Instruction::FMul: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: + case Instruction::And: + case Instruction::Or: + case Instruction::Xor: + case Instruction::Shl: + case Instruction::LShr: + case Instruction::AShr: + case Instruction::ICmp: + case Instruction::FCmp: + case Instruction::Select: + case Instruction::ShuffleVector: { + addAssignEdge(CE->getOperand(0), CE); + addAssignEdge(CE->getOperand(1), CE); break; } - case Instruction::IntToPtr: - addNode(CE, getAttrUnknown()); - break; case Instruction::BitCast: case Instruction::AddrSpaceCast: @@ -535,70 +547,38 @@ case Instruction::SIToFP: case Instruction::FPToUI: case Instruction::FPToSI: { - auto *Src = CE->getOperand(0); - addAssignEdge(Src, CE); + addAssignEdge(CE->getOperand(0), CE); break; } - case Instruction::Select: { - auto *TrueVal = CE->getOperand(0); - auto *FalseVal = CE->getOperand(1); - addAssignEdge(TrueVal, CE); - addAssignEdge(FalseVal, CE); + + case Instruction::GetElementPtr: { + auto GEPOp = cast(CE); + visitGEP(*GEPOp); break; } - case Instruction::InsertElement: { - auto *Vec = CE->getOperand(0); - auto *Val = CE->getOperand(1); - addAssignEdge(Vec, CE); - addStoreEdge(Val, CE); + + case Instruction::PtrToInt: { + addNode(CE->getOperand(0), getAttrEscaped()); break; } - case Instruction::ExtractElement: { - auto *Ptr = CE->getOperand(0); - addLoadEdge(Ptr, CE); + + case Instruction::IntToPtr: { + addNode(CE, getAttrUnknown()); break; } + + case Instruction::InsertElement: case Instruction::InsertValue: { - auto *Agg = CE->getOperand(0); - auto *Val = CE->getOperand(1); - addAssignEdge(Agg, CE); - addStoreEdge(Val, CE); + addAssignEdge(CE->getOperand(0), CE); + addStoreEdge(CE->getOperand(1), CE); break; } + + case Instruction::ExtractElement: case Instruction::ExtractValue: { - auto *Ptr = CE->getOperand(0); - addLoadEdge(Ptr, CE); + addLoadEdge(CE->getOperand(0), CE); break; } - case Instruction::ShuffleVector: { - auto *From1 = CE->getOperand(0); - auto *From2 = CE->getOperand(1); - addAssignEdge(From1, CE); - addAssignEdge(From2, CE); - break; - } - case Instruction::Add: - case Instruction::Sub: - case Instruction::FSub: - case Instruction::Mul: - case Instruction::FMul: - case Instruction::UDiv: - case Instruction::SDiv: - case Instruction::FDiv: - case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: - case Instruction::And: - case Instruction::Or: - case Instruction::Xor: - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: - case Instruction::ICmp: - case Instruction::FCmp: - addAssignEdge(CE->getOperand(0), CE); - addAssignEdge(CE->getOperand(1), CE); - break; default: llvm_unreachable("Unknown instruction type encountered!");