llvm.org GIT mirror llvm / 4ecbca5
Avoid analyzing instructions in blocks not reachable from the entry block. They are lots of trouble, and they don't matter. This fixes PR6559. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98103 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
2 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
31003100 return getUnknown(V);
31013101
31023102 unsigned Opcode = Instruction::UserOp1;
3103 if (Instruction *I = dyn_cast(V))
3103 if (Instruction *I = dyn_cast(V)) {
31043104 Opcode = I->getOpcode();
3105 else if (ConstantExpr *CE = dyn_cast(V))
3105
3106 // Don't attempt to analyze instructions in blocks that aren't
3107 // reachable. Such instructions don't matter, and they aren't required
3108 // to obey basic rules for definitions dominating uses which this
3109 // analysis depends on.
3110 if (!DT->isReachableFromEntry(I->getParent()))
3111 return getUnknown(V);
3112 } else if (ConstantExpr *CE = dyn_cast(V))
31063113 Opcode = CE->getOpcode();
31073114 else if (ConstantInt *CI = dyn_cast(V))
31083115 return getConstant(CI);
0 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
1
2 ; CHECK: %t = add i64 %t, 1
3 ; CHECK: --> %t
4
5 define void @foo() {
6 entry:
7 ret void
8
9 dead:
10 %t = add i64 %t, 1
11 ret void
12 }