summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
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
commit5451c9e977690c73a67b0fb44ea84a2e18112d47 (patch)
tree11fb1c98ab7b19f6a1186ee07f89156642538445 /llvm/lib/Transforms
parent5b1200bf8e54ee484f29a3bd848c3f1d1a4d7bb4 (diff)
downloadbcm5719-llvm-5451c9e977690c73a67b0fb44ea84a2e18112d47.tar.gz
bcm5719-llvm-5451c9e977690c73a67b0fb44ea84a2e18112d47.zip
Add knowledge about the struct form of the GetElementPtr instruction
llvm-svn: 183
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 79d90e65326..63ce5125087 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud