From 6428a27ee3d54660a315c864d98b821d0607dfca Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Apr 2002 14:44:13 +0000 Subject: [PATCH] GEP instructions can never be constant propogated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2284 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/SCCP.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index e6cf765e555..e7e8f4177cb 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -429,14 +429,9 @@ void SCCP::UpdateInstruction(Instruction *I) { //===-------------------------------------------------------------------===// - // Handle Unary instructions... - // Also treated as unary here, are cast instructions and getelementptr - // instructions on struct* operands. + // Handle Unary and cast instructions... // - if (isa(I) || isa(I) || - (isa(I) && - cast(I)->isStructSelector())) { - + if (isa(I) || isa(I)) { Value *V = I->getOperand(0); InstVal &VState = getValueState(V); if (VState.isOverdefined()) { // Inherit overdefinedness of operand @@ -456,6 +451,16 @@ void SCCP::UpdateInstruction(Instruction *I) { return; } + + //===-----------------------------------------------------------------===// + // Handle GetElementPtr instructions... + // + if (isa(I)) { + markOverdefined(I); + return; + } + + //===-----------------------------------------------------------------===// // Handle Binary instructions... //