diff options
author | Manman Ren <mren@apple.com> | 2012-09-05 23:45:58 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-09-05 23:45:58 +0000 |
commit | f3fedb6935215de8125adeac67d0d97b2b74aa20 (patch) | |
tree | e2946b37a91ebeff2ecfbe325a3a1773064a373a /llvm/lib/Analysis/LazyValueInfo.cpp | |
parent | 3245e584db566ac81c87dfc4b87003bf8a7c2405 (diff) | |
download | bcm5719-llvm-f3fedb6935215de8125adeac67d0d97b2b74aa20.tar.gz bcm5719-llvm-f3fedb6935215de8125adeac67d0d97b2b74aa20.zip |
JumpThreading: when default destination is the destination of some cases in a
switch, make sure we include the value for the cases when calculating edge
value from switch to the default destination.
rdar://12241132
llvm-svn: 163270
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index c2306b4e9c1..ec618fad22e 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -847,9 +847,12 @@ static bool getEdgeValueLocal(Value *Val, BasicBlock *BBFrom, for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i) { ConstantRange EdgeVal(i.getCaseValue()->getValue()); - if (DefaultCase) - EdgesVals = EdgesVals.difference(EdgeVal); - else if (i.getCaseSuccessor() == BBTo) + if (DefaultCase) { + // It is possible that the default destination is the destination of + // some cases. There is no need to perform difference for those cases. + if (i.getCaseSuccessor() != BBTo) + EdgesVals = EdgesVals.difference(EdgeVal); + } else if (i.getCaseSuccessor() == BBTo) EdgesVals = EdgesVals.unionWith(EdgeVal); } Result = LVILatticeVal::getRange(EdgesVals); |