summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-14 06:11:51 +0000
committerChris Lattner <sabre@nondot.org>2001-07-14 06:11:51 +0000
commit3b7bfdb201fadea61639dee8f4de4181d745e858 (patch)
tree91e7e1fbf7e85a02da1336c98648aebdc787ff31 /lib
parent20a155f5ab9f9021f04fc672ae44cd0845793371 (diff)
downloadllvm-3b7bfdb201fadea61639dee8f4de4181d745e858.tar.gz
llvm-3b7bfdb201fadea61639dee8f4de4181d745e858.tar.bz2
llvm-3b7bfdb201fadea61639dee8f4de4181d745e858.tar.xz
Add knowledge about the struct form of the GetElementPtr instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 79d90e6532..63ce512508 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -23,6 +23,7 @@
#include "llvm/ConstantPool.h"
#include "llvm/InstrTypes.h"
#include "llvm/iOther.h"
+#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
#include "llvm/Tools/STLExtras.h"
#include "llvm/Assembly/Writer.h"
@@ -429,8 +430,13 @@ void SCCP::UpdateInstruction(Instruction *I) {
//===-------------------------------------------------------------------===//
// Handle Unary instructions...
+ // Also treated as unary here, are cast instructions and getelementptr
+ // instructions on struct* operands.
//
- if (I->isUnaryOp() || I->getOpcode() == Instruction::Cast) {
+ if (I->isUnaryOp() || I->getOpcode() == Instruction::Cast ||
+ (I->getOpcode() == Instruction::GetElementPtr &&
+ ((GetElementPtrInst*)I)->isStructSelector())) {
+
Value *V = I->getOperand(0);
InstVal &VState = getValueState(V);
if (VState.isOverdefined()) { // Inherit overdefinedness of operand