llvm-6502/lib/Transforms/Utils
Andrew Trick b1b97833ae Preserve branch profile metadata during switch formation.
Patch by Michael Ilseman!
This fixes SimplifyCFGOpt::FoldValueComparisonIntoPredecessors to preserve metata when folding conditional branches into switches.

void foo(int x) {
  if (x == 0)
    bar(1);
  else if (__builtin_expect(x == 10, 1))
    bar(2);
  else if (x == 20)
    bar(3);
}

CFG:

B0
|  \
|   X0
B10
|  \
|   X10
B20
|  \
E   X20

Merge B0-B10:
w(B0-X0) = w(B0-X0)*sum-weights(B10) = w(B0-X0) * (w(B10-X10) + w(B10-B20))
w(B0-X10) = w(B0-B10) * w(B10-X10)
w(B0-B20) = w(B0-B10) * w(B10-B20)

B0 __
| \  \
| X10 X0
B20
|  \
E  X20

Merge B0-B20:
w(B0-X0) = w(B0-X0) * sum-weights(B20) = w(B0-X0) * (w(B20-E) + w(B20-X20))
w(B0-X10) = w(B0-X10) * sum-weights(B20) = ...
w(B0-X20) = w(B0-B20) * w(B20-X20)
w(B0-E) = w(B0-B20) * w(B20-E)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162868 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29 21:46:38 +00:00
..
AddrModeMatcher.cpp Add a little heuristic to Value::isUsedInBasicBlock to speed it up for small basic blocks. 2011-12-05 17:23:27 +00:00
BasicBlockUtils.cpp Make MemoryBuiltins aware of TargetLibraryInfo. 2012-08-29 15:32:21 +00:00
BreakCriticalEdges.cpp Second attempt at PR12573: 2012-04-30 10:44:54 +00:00
BuildLibCalls.cpp remove tabs from my previous commit. 2012-08-01 17:13:28 +00:00
CloneFunction.cpp Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and 2012-06-28 00:05:13 +00:00
CloneModule.cpp Extend the IL for selecting TLS models (PR9788) 2012-06-23 11:37:03 +00:00
CMakeLists.txt llvm/lib: [CMake] Add explicit dependency to intrinsics_gen. 2012-06-24 13:32:01 +00:00
CmpInstAnalysis.cpp Convert assert(0) to llvm_unreachable 2012-02-07 05:05:23 +00:00
CodeExtractor.cpp Fixed r158979. 2012-06-22 14:53:30 +00:00
DemoteRegToStack.cpp Remove redundant comment. Use a more efficient datatype. 2012-02-17 02:12:54 +00:00
InlineFunction.cpp Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h 2012-06-29 12:38:19 +00:00
InstructionNamer.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
LCSSA.cpp There is no need to force DebugLoc on a PHI at this point. 2011-05-16 22:05:03 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Local.cpp Make MemoryBuiltins aware of TargetLibraryInfo. 2012-08-29 15:32:21 +00:00
LoopSimplify.cpp LoopSimplify bug fix. Handle indirect loop back edges. 2012-03-20 21:24:52 +00:00
LoopUnroll.cpp LoopUnroll: always check for NULL LoopPassManager 2012-06-05 17:51:05 +00:00
LoopUnrollRuntime.cpp Fix typos found by http://github.com/lyda/misspell-check 2012-06-02 10:20:22 +00:00
LowerExpectIntrinsic.cpp Move llvm/Support/MDBuilder.h to llvm/MDBuilder.h, to live with 2012-07-15 23:26:50 +00:00
LowerInvoke.cpp [unwind removal] We no longer have 'unwind' instructions being generated, so 2012-02-06 21:16:41 +00:00
LowerSwitch.cpp Reverted r156659, due to probable performance regressions, DenseMap should be used here: 2012-07-04 05:53:05 +00:00
Makefile
Mem2Reg.cpp Remove outdated references to dominance frontiers. 2011-01-18 03:53:26 +00:00
ModuleUtils.cpp Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h 2012-06-29 12:38:19 +00:00
PromoteMemoryToRegister.cpp The DIBuilder class is just a wrapper around debug info creation 2012-06-29 08:32:07 +00:00
SimplifyCFG.cpp Preserve branch profile metadata during switch formation. 2012-08-29 21:46:38 +00:00
SimplifyIndVar.cpp Remove unused private fields found by clang's new -Wunused-private-field. 2012-06-06 18:25:08 +00:00
SimplifyInstructions.cpp Make MemoryBuiltins aware of TargetLibraryInfo. 2012-08-29 15:32:21 +00:00
SSAUpdater.cpp Fix undefined behavior (binding a reference to a dereferenced null pointer) if 2012-08-17 21:42:44 +00:00
UnifyFunctionExitNodes.cpp [unwind removal] We no longer have 'unwind' instructions being generated, so 2012-02-06 21:16:41 +00:00
Utils.cpp Add a new convenience pass for testing InstructionSimplify. Previously 2010-12-20 20:54:37 +00:00
ValueMapper.cpp We need to map DebugLoc. It leads to Fuction * (through subprogram entry node) which should be appropriately mapped. 2011-08-04 20:02:18 +00:00