llvm-6502/test/Transforms/SimplifyCFG
Jakob Stoklund Olesen 58e9ee85fd Teach SimplifyCFG about magic pointer constants.
Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.

Code like this:

void f(const char *x) {
  if (!x)
    puts("null");
  else if ((uintptr_t)x == 1)
    puts("one");
  else if (x == (char*)2 || x == (char*)3)
    puts("two");
  else if ((intptr_t)x == 4)
    puts("four");
  else
    puts(x);
}

Now becomes a switch:

define void @f(i8* %x) nounwind ssp {
entry:
  %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
  switch i64 %magicptr23, label %if.else16 [
    i64 0, label %if.then
    i64 1, label %if.then2
    i64 2, label %if.then9
    i64 3, label %if.then9
    i64 4, label %if.then14
  ]

Note that LLVM's own DenseMap uses magic pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 22:03:18 +00:00
..
2002-05-05-EmptyBlockMerge.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2002-05-21-PHIElimination.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2002-06-24-PHINode.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
2002-09-24-PHIAssertion.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-03-07-DominateProblem.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-05-InvokeCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-05-MishandleInvoke.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-17-BranchFold.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-17-BranchFoldOrdering.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2003-08-17-FoldSwitch-dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
2003-08-17-FoldSwitch.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2004-12-10-SimplifyCFGCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-06-16-PHICrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-08-01-PHIUpdateFail.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-08-03-PHIFactorCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-10-02-InvokeSimplify.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2005-12-03-IncorrectPHIFold.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-02-17-InfiniteUnroll.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-06-12-InfLoop.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-08-03-Crash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-10-19-UncondDiv.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-10-29-InvokeCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2006-12-08-Ptr-ICmp-Branch.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2007-11-22-InvokeNoUnwind.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2007-12-21-Crash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-01-02-hoist-fp-add.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-04-23-MergeMultipleResultRet.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-04-27-MultipleReturnCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-05-16-PHIBlockMerge.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-07-13-InfLoopMiscompile.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-09-08-MultiplePred.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-09-17-SpeculativeHoist.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-10-03-SpeculativelyExecuteBeforePHI.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-12-06-SingleEntryPhi.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2008-12-16-DCECond.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2009-01-18-PHIPropCrash.ll Optimize test more. 2009-11-10 21:02:18 +00:00
2009-01-19-UnconditionalTrappingConstantExpr.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2009-03-05-Speculative-Hoist-Dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
2009-05-12-externweak.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
2009-06-15-InvokeCrash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
basictest.ll Implement PR5795 by merging duplicated return blocks. This could go further 2009-12-22 06:07:30 +00:00
branch_fold_dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
branch-branch-dbginfo.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
branch-cond-merge.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
branch-cond-prop.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
branch-fold-test.ll Use opt -S instead of piping bitcode output through llvm-dis. 2009-09-08 22:34:10 +00:00
branch-fold.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
branch-phi-thread.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
BrUnwind.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
dbginfo.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
DeadSetCC.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
dg.exp
duplicate-phis.ll fix two bogus tests that the asmparser now rejects. 2009-12-30 05:54:51 +00:00
EqualPHIEdgeBlockMerge.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
hoist-common-code.dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
hoist-common-code.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
HoistCode.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
invoke_unwind.ll change simplifycfg to not duplicate 'unwind' instructions. Hopefully 2009-10-13 18:13:05 +00:00
iterative-simplify.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
MagicPointer.ll Teach SimplifyCFG about magic pointer constants. 2010-02-05 22:03:18 +00:00
noreturn-call.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
PhiBlockMerge2.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
PhiBlockMerge.ll Revert r85667. LoopUnroll currently can't call utility functions which 2009-10-31 17:33:01 +00:00
PhiEliminate2.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
PhiEliminate.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
PhiNoEliminate.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
return-merge.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
SpeculativeExec.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
switch_create.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
switch_formation.dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
switch_formation.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
switch_switch_fold_dbginfo.ll Use opt -S instead of piping bitcode output through llvm-dis. 2009-09-08 22:34:10 +00:00
switch_switch_fold.ll Use opt -S instead of piping bitcode output through llvm-dis. 2009-09-08 22:34:10 +00:00
switch_thread.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
switch-simplify-crash.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
trapping-load-unreachable.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
two-entry-phi-return.dbg.ll Delete useless trailing semicolons. 2010-01-05 17:55:26 +00:00
two-entry-phi-return.ll fix a bunch of spurious failures for people whose home directory 2009-09-11 17:02:12 +00:00
UncondBranchToReturn.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00
UnreachableEliminate.ll Change tests from "opt %s" to "opt < %s" so that opt doesn't see the 2009-09-11 18:01:28 +00:00