#
0e46d8a0 |
| 02-Jun-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
PR1255: case ranges. IntRange converted from struct to class. So main change everywhere is replacement of ".Low/High" with ".getLow/getHigh()"
llvm-svn: 157884
|
#
58107dd5 |
| 29-May-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
llvm-svn: 157612
|
#
e3e19cbb |
| 28-May-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
PR1255: Case Ranges Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now? 1. It will very difficult to implement case ranges as series of small patches. We got
PR1255: Case Ranges Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now? 1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst. 2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case. 3. IntItem can be easyly easily replaced with APInt. 4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes.
Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code ConstantInt *V = ...; if (V->getValue().ugt(AnotherV->getValue()) { ... } will look awful. Much more better this way: IntItem V = ConstantIntVal->getValue(); if (AnotherV < V) { }
Of course any reviews are welcome.
P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks). Since in future these classes will founded on APInt, it will possible to use them in more generic ways.
llvm-svn: 157576
show more ...
|
#
7a501552 |
| 23-May-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
PR1255(case ranges) related changes in Local Transformations.
llvm-svn: 157315
|
Revision tags: llvmorg-3.1.0 |
|
#
300d6299 |
| 10-May-2012 |
Nuno Lopes <nunoplopes@sapo.pt> |
teach DSE and isInstructionTriviallyDead() about calloc
llvm-svn: 156553
|
Revision tags: llvmorg-3.1.0-rc3, llvmorg-3.1.0-rc2, llvmorg-3.1.0-rc1 |
|
#
ba0a6cab |
| 04-Apr-2012 |
Rafael Espindola <rafael.espindola@gmail.com> |
Always compute all the bits in ComputeMaskedBits. This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcomb
Always compute all the bits in ComputeMaskedBits. This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcombine to simplify cases like the one in the included testcase.
llvm-svn: 154011
show more ...
|
#
0c72e3f4 |
| 25-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Add an asserting ValueHandle to the block simplification code which will fire if anything ever invalidates the assumption of a terminator instruction being unchanged throughout the routine.
I've con
Add an asserting ValueHandle to the block simplification code which will fire if anything ever invalidates the assumption of a terminator instruction being unchanged throughout the routine.
I've convinced myself that the current definition of simplification precludes such a transformation, so I think getting some asserts coverage that we don't violate this agreement is sufficient to make this code safe for the foreseeable future.
Comments to the contrary or other suggestions are of course welcome. =] The bots are now happy with this code though, so it appears the bug here has indeed been fixed.
llvm-svn: 153401
show more ...
|
#
17fc6ef2 |
| 24-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Don't form a WeakVH around the sentinel node in the instructions BB list. This is a bad idea. ;] I'm hopeful this is the bug that's showing up with the MSVC bots, but we'll see.
It is definitely unn
Don't form a WeakVH around the sentinel node in the instructions BB list. This is a bad idea. ;] I'm hopeful this is the bug that's showing up with the MSVC bots, but we'll see.
It is definitely unnecessary. InstSimplify won't do anything to a terminator instruction, we don't need to even include it in the iteration range. We can also skip the now dead terminator check, although I've made it an assert to help document that this is an important invariant.
I'm still a bit queasy about this because there is an implicit assumption that the terminator instruction cannot be RAUW'ed by the simplification code. While that appears to be true at the moment, I see no guarantee that would ensure it remains true in the future. I'm looking at the cleanest way to solve that...
llvm-svn: 153399
show more ...
|
#
cf1b585f |
| 24-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Refactor the interface to recursively simplifying instructions to be tad bit simpler by handling a common case explicitly.
Also, refactor the implementation to use a worklist based walk of the recur
Refactor the interface to recursively simplifying instructions to be tad bit simpler by handling a common case explicitly.
Also, refactor the implementation to use a worklist based walk of the recursive users, rather than trying to use value handles to detect and recover from RAUWs during the recursive descent. This fixes a very subtle bug in the previous implementation where degenerate control flow structures could cause mutually recursive instructions (PHI nodes) to collapse in just such a way that From became equal to To after some amount of recursion. At that point, we hit the inf-loop that the assert at the top attempted to guard against. This problem is defined away when not using value handles in this manner. There are lots of comments claiming that the WeakVH will protect against just this sort of error, but they're not accurate about the actual implementation of WeakVHs, which do still track RAUWs.
I don't have any test case for the bug this fixes because it requires running the recursive simplification on unreachable phi nodes. I've no way to either run this or easily write an input that triggers it. It was found when using instruction simplification inside the inliner when running over the nightly test-suite.
llvm-svn: 153393
show more ...
|
#
97b02fc1 |
| 11-Mar-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
llvm::SwitchInst Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default. Added some notes relative to case iterators.
llvm-svn: 152532
|
#
5b648afb |
| 08-Mar-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html
Implemented CaseIterator and it solves almost
Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html
Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".
ConstCaseIt is just a read-only iterator. CaseIt is read-write iterator; it allows to change case successor and case value.
Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.
Main way of iterator usage looks like this: SwitchInst *SI = ... // intialize it somehow
for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) { BasicBlock *BB = i.getCaseSuccessor(); ConstantInt *V = i.getCaseValue(); // Do something. }
If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method. If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.
There are also related changes in llvm-clients: klee and clang.
llvm-svn: 152297
show more ...
|
#
513aaa56 |
| 01-Feb-2012 |
Stepan Dyatkovskiy <stpworld@narod.ru> |
SwitchInst refactoring. The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods t
SwitchInst refactoring. The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.
What was done:
1. Changed semantics of index inside the getCaseValue method: getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous. 2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned. 3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment. 4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst. 4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor. 4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.
Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang. llvm-svn: 149481
show more ...
|
#
b5188f16 |
| 06-Dec-2011 |
Benjamin Kramer <benny.kra@googlemail.com> |
Simplify common predecessor finding.
- Walking over pred_begin/pred_end is an expensive operation. - PHINodes contain a value for each predecessor anyway. - While it may look like we used to save a
Simplify common predecessor finding.
- Walking over pred_begin/pred_end is an expensive operation. - PHINodes contain a value for each predecessor anyway. - While it may look like we used to save a few iterations with the set, be aware that getIncomingValueForBlock does a linear search on the values of the phi node. - Another -5% on ARMDisassembler.cpp (Release build). This was the last entry in the profile that was obviously wasting time.
llvm-svn: 145937
show more ...
|
#
ca6f8ddb |
| 29-Nov-2011 |
Duncan Sands <baldrick@free.fr> |
Fix a theoretical problem (not seen in the wild): if different instances of a weak variable are compiled by different compilers, such as GCC and LLVM, while LLVM may increase the alignment to the pre
Fix a theoretical problem (not seen in the wild): if different instances of a weak variable are compiled by different compilers, such as GCC and LLVM, while LLVM may increase the alignment to the preferred alignment there is no reason to think that GCC will use anything more than the ABI alignment. Since it is the GCC version that might end up in the final program (as the linkage is weak), it is wrong to increase the alignment of loads from the global up to the preferred alignment as the alignment might only be the ABI alignment.
Increasing alignment up to the ABI alignment might be OK, but I'm not totally convinced that it is. It seems better to just leave the alignment of weak globals alone.
llvm-svn: 145413
show more ...
|
Revision tags: llvmorg-3.0.0, llvmorg-3.0.0-rc4, llvmorg-3.0.0-rc3, llvmorg-3.0.0-rc2 |
|
#
dd1d3df5 |
| 24-Oct-2011 |
Nick Lewycky <nicholas@mxc.ca> |
A dead malloc, a free(NULL) and a free(undef) are all trivially dead instructions.
This doesn't introduce any optimizations we weren't doing before (except potentially due to pass ordering issues),
A dead malloc, a free(NULL) and a free(undef) are all trivially dead instructions.
This doesn't introduce any optimizations we weren't doing before (except potentially due to pass ordering issues), now passes will eliminate them sooner as part of their own cleanups.
llvm-svn: 142787
show more ...
|
Revision tags: llvmorg-3.0.0-rc1 |
|
#
de7ab801 |
| 10-Oct-2011 |
Lang Hames <lhames@gmail.com> |
Add a natural stack alignment field to TargetData, and prevent InstCombine from promoting allocas to preferred alignments that exceed the natural alignment. This avoids some potentially expensive dyn
Add a natural stack alignment field to TargetData, and prevent InstCombine from promoting allocas to preferred alignments that exceed the natural alignment. This avoids some potentially expensive dynamic stack realignments.
The natural stack alignment is set in target data strings via the "S<size>" option. Size is in bits and must be a multiple of 8. The natural stack alignment defaults to "unspecified" (represented by a zero value), and the "unspecified" value does not prevent any alignment promotions. Target maintainers that care about avoiding promotions should explicitly add the "S<size>" option to their target data strings.
llvm-svn: 141599
show more ...
|
#
d9fb4707 |
| 15-Aug-2011 |
Bill Wendling <isanbard@gmail.com> |
The "landingpad" instruction will never be "trivially" dead.
llvm-svn: 137642
|
#
99890a22 |
| 02-Aug-2011 |
Nick Lewycky <nicholas@mxc.ca> |
Lifetime intrinsics on undef are dead.
llvm-svn: 136722
|
#
911e12f5 |
| 20-Jul-2011 |
Eli Friedman <eli.friedman@gmail.com> |
Clean up includes of llvm/Analysis/ConstantFolding.h so it's included where it's used and not included where it isn't.
llvm-svn: 135628
|
#
b10a0f22 |
| 30-Jun-2011 |
Rafael Espindola <rafael.espindola@gmail.com> |
Add r134057 back, but splice the predecessor after the successors phi nodes.
Original message: Let simplify cfg simplify bb with only debug and lifetime intrinsics.
llvm-svn: 134182
|
#
96ed721d |
| 29-Jun-2011 |
Chad Rosier <mcrosier@apple.com> |
Temporarily revert r134057: "Let simplify cfg simplify bb with only debug and lifetime intrinsics" due to buildbot failures.
llvm-svn: 134071
|
#
4c0dfcec |
| 29-Jun-2011 |
Rafael Espindola <rafael.espindola@gmail.com> |
Let simplify cfg simplify bb with only debug and lifetime intrinsics.
llvm-svn: 134057
|
#
fa44dc65 |
| 28-Jun-2011 |
Nick Lewycky <nicholas@mxc.ca> |
Fix typo in comment.
llvm-svn: 133990
|
#
61ea0e46 |
| 23-Jun-2011 |
Jay Foad <jay.foad@gmail.com> |
Reinstate r133513 (reverted in r133700) with an additional fix for a -Wshorten-64-to-32 warning in Instructions.h.
llvm-svn: 133708
|
#
96513120 |
| 23-Jun-2011 |
Eric Christopher <echristo@apple.com> |
Revert r133513:
"Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)."
Due to some additional warnings.
llvm-svn: 133700
|