| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
llvm-svn: 156257
|
|
|
|
|
|
| |
operand is of pointer type (and not vector type).
llvm-svn: 153468
|
|
|
|
| |
llvm-svn: 153465
|
|
|
|
|
|
|
| |
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.
llvm-svn: 152532
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
instead of always using ConstantVector.
llvm-svn: 149912
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.
llvm-svn: 149116
|
|
|
|
|
|
| |
new methods recently added to (sometimes greatly!) simplify code.
llvm-svn: 149024
|
|
|
|
| |
llvm-svn: 145801
|
|
|
|
|
|
| |
Add FIXMEs to places that are non-trivial to fix.
llvm-svn: 145661
|
|
|
|
|
|
|
| |
where it appeared beneficial to pass.
More of rdar://10500969
llvm-svn: 145630
|
|
|
|
|
|
|
|
| |
(fptrunc (sqrt (fpext x))) -> (sqrtf x) transformation if -fno-builtin is
specified.
rdar://10466410
llvm-svn: 145460
|
|
|
|
| |
llvm-svn: 144648
|
|
|
|
|
|
| |
with another instruction. (Specifically, don't insert an arbitrary instruction before a PHI.) Fixes PR11275.
llvm-svn: 143437
|
|
|
|
|
|
|
|
| |
combining of the landingpad instruction. The ObjC personality function acts
almost identically to the C++ personality function. In particular, it uses
"null" as a "catch-all" value.
llvm-svn: 142256
|
|
|
|
|
|
|
|
|
|
|
|
| |
profile metadata at the same time. Use it to preserve metadata attached
to a branch when re-writing it in InstCombine.
Add metadata to the canonicalize_branch InstCombine test, and check that
it is tranformed correctly.
Reviewed by Nick Lewycky!
llvm-svn: 142168
|
|
|
|
|
|
|
|
| |
Just pull the instruction name, but don't change the order of anything
else. That keeps --debug happy and non-crashing, but doesn't change
how the worklist gets built.
llvm-svn: 141210
|
|
|
|
| |
llvm-svn: 141209
|
|
|
|
|
|
|
|
|
|
|
|
| |
When updating the worklist for InstCombine, the Add/AddUsersToWorklist
functions may access the instruction(s) being added, for debug output for
example. If the instructions aren't yet added to the basic block, this
can result in a crash. Finish the instruction transformation before
adjusting the worklist instead.
rdar://10238555
llvm-svn: 141203
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
catch or repeated filter clauses. Teach instcombine a bunch
of tricks for simplifying landingpad clauses. Currently the
code only recognizes the GNU C++ and Ada personality functions,
but that doesn't stop it doing a bunch of "generic" transforms
which are hopefully fine for any real-world personality function.
If these "generic" transforms turn out not to be generic, they
can always be conditioned on the personality function. Probably
someone should add the ObjC++ personality function. I didn't as
I don't know anything about it.
llvm-svn: 140852
|
|
|
|
|
|
| |
operand ordering. Patch by Stepan Dyatkovskiy.
llvm-svn: 140803
|
|
|
|
|
|
| |
landingpad and terminator).
llvm-svn: 139090
|
|
|
|
| |
llvm-svn: 139023
|
|
|
|
| |
llvm-svn: 138968
|
|
|
|
|
|
| |
Duncan noticed this!
llvm-svn: 138967
|
|
|
|
|
|
| |
which should be removed only when its invokes are.
llvm-svn: 138932
|
|
|
|
| |
llvm-svn: 138931
|
|
|
|
|
|
| |
The landingpad instruction can be removed only when its invokes are removed.
llvm-svn: 138930
|
|
|
|
|
|
| |
instruction should be marked as potentially reading and/or writing memory.
llvm-svn: 137863
|
|
|
|
|
|
| |
check for a LandingPadInst.
llvm-svn: 137745
|
|
|
|
| |
llvm-svn: 137672
|
|
|
|
| |
llvm-svn: 137664
|
|
|
|
|
|
| |
write to memory.) Marking it as such makes some checks for immobility go away.
llvm-svn: 137655
|
|
|
|
| |
llvm-svn: 137629
|
|
|
|
| |
llvm-svn: 137575
|
|
|
|
| |
llvm-svn: 137572
|
|
|
|
|
|
| |
when combining add and sub instructions. Patch by Pranav Bhandarkar!
llvm-svn: 137570
|
|
|
|
|
|
|
|
|
| |
- use SmallVectorImpl& for the function argument.
- ignore the operands on the GEP, even if they aren't constant! Much as we
pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by
is not null. It's magic!
llvm-svn: 136757
|
|
|
|
|
|
|
|
|
| |
Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)"
which in turn means "unreachable". What we wanted was a no-op. Instead, analyze
the whole tree and look for all the instructions we need to delete first, then
delete them second, not relying on the use_list to stay consistent.
llvm-svn: 136752
|
|
|
|
|
|
| |
malloc call.
llvm-svn: 136732
|
|
|
|
| |
llvm-svn: 136585
|
|
|
|
| |
llvm-svn: 135904
|
|
|
|
|
|
| |
ArrayRef.
llvm-svn: 135761
|
|
|
|
| |
llvm-svn: 135482
|
|
|
|
|
|
|
|
| |
previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.
llvm-svn: 135390
|
|
|
|
| |
llvm-svn: 135375
|
|
|
|
| |
llvm-svn: 135040
|
|
|
|
|
|
|
|
| |
more than one use.
Fixes PR10322.
llvm-svn: 134883
|
|
|
|
|
|
| |
InsertNewInstWith, and use setDebugLoc for the cases which can't be easily handled by the automated mechanisms.
llvm-svn: 132167
|