diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-10-12 18:05:47 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-10-12 18:05:47 +0000 |
| commit | ad618f66e6794cb34d01b609554018ec2cef28cc (patch) | |
| tree | 6844fc870ae6e7919d83aa264f6aebc933c19807 /llvm/lib/Transforms | |
| parent | a1a4a9ebfa0d3948886c71d6c408945847c42f1c (diff) | |
| download | bcm5719-llvm-ad618f66e6794cb34d01b609554018ec2cef28cc.tar.gz bcm5719-llvm-ad618f66e6794cb34d01b609554018ec2cef28cc.zip | |
Fix a bug in my patch last night that broke InstCombine/2007-10-12-Crash.ll
llvm-svn: 42920
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 2c88279afb0..3096cab4c3c 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -8643,8 +8643,14 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { // converted to match the type of the cast, don't touch this. if (isa<AllocationInst>(BCI->getOperand(0))) { // See if the bitcast simplifies, if so, don't nuke this GEP yet. - if (visitBitCast(*BCI)) + if (Instruction *I = visitBitCast(*BCI)) { + if (I != BCI) { + I->takeName(BCI); + BCI->getParent()->getInstList().insert(BCI, I); + ReplaceInstUsesWith(*BCI, I); + } return &GEP; + } } return new BitCastInst(BCI->getOperand(0), GEP.getType()); } |

