search for: switchval

Displaying 6 results from an estimated 6 matches for "switchval".

2011 Feb 08
2
[LLVMdev] A small pass to constant fold branch conditions in destination blocks
...ed by Y everywhere in the false > destination). Completely untested for correctness! Not to discourage you, but you're reinventing predsimplify. What PS did was find branches (or switches) where the target block was uniquely dominated by a single case, then assign %cond = true/false (or %switchval = const) and then walk up propagating that condition upwards (ie., if %cond = and i1 %a, %b then %a and %b are true, and if %a = icmp eq i32 %a, i32 0 then PS would immediately find all uses of %a dominated by that branch and replace them with 0 on the spot). After walking up, you would walk do...
2011 Feb 08
0
[LLVMdev] A small pass to constant fold branch conditions in destination blocks
...t;> destination). Completely untested for correctness! > > Not to discourage you, but you're reinventing predsimplify. > > What PS did was find branches (or switches) where the target block was > uniquely dominated by a single case, then assign %cond = true/false (or > %switchval = const) and then walk up propagating that condition upwards > (ie., if %cond = and i1 %a, %b then %a and %b are true, and if %a = icmp > eq i32 %a, i32 0 then PS would immediately find all uses of %a dominated > by that branch and replace them with 0 on the spot). After walking up, &g...
2011 Feb 08
1
[LLVMdev] A small pass to constant fold branch conditions in destination blocks
...pletely untested for correctness! >> >> Not to discourage you, but you're reinventing predsimplify. >> >> What PS did was find branches (or switches) where the target block was >> uniquely dominated by a single case, then assign %cond = true/false (or >> %switchval = const) and then walk up propagating that condition upwards >> (ie., if %cond = and i1 %a, %b then %a and %b are true, and if %a = icmp >> eq i32 %a, i32 0 then PS would immediately find all uses of %a dominated >> by that branch and replace them with 0 on the spot). After wal...
2011 Feb 07
0
[LLVMdev] A small pass to constant fold branch conditions in destination blocks
Here is a new and improved version that also does the following: if the condition for a conditional branch has the form "A && B" then A, B and the condition are all replaced with "true" in the true destination (similarly for || conditions in the false destination). Also, if the condition has the form "X == Y" then X is replaced by Y everywhere in the true
2010 Jan 09
2
[LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
...st_iterator ci = BlocksToExtract.begin(), + for (SetVector<BasicBlock*>::const_iterator ci = BlocksToExtract.begin(), ce = BlocksToExtract.end(); ci != ce; ++ci) { BasicBlock *BB = *ci; @@ -482,7 +483,7 @@ std::map<BasicBlock*, BasicBlock*> ExitBlockMap; unsigned switchVal = 0; - for (std::set<BasicBlock*>::const_iterator i = BlocksToExtract.begin(), + for (SetVector<BasicBlock*>::const_iterator i = BlocksToExtract.begin(), e = BlocksToExtract.end(); i != e; ++i) { TerminatorInst *TI = (*i)->getTerminator(); for (unsigned i = 0, e...
2011 Feb 07
7
[LLVMdev] A small pass to constant fold branch conditions in destination blocks
Hi all, I wrote a little pass (attached) which does the following: if it sees a conditional branch instruction then it replaces all occurrences of the condition in the true block with "true" and in the false block with "false". Well, OK, it is a bit more sophisticated (and a bit more careful!) than that but you get the idea. It will turn this define i1 @t1(i1 %c) { br