llvm-6502/test
Chandler Carruth 2770c14185 Fix an overflow bug in MachineBranchProbabilityInfo. This pass relied on
the sum of the edge weights not overflowing uint32, and crashed when
they did. This is generally safe as BranchProbabilityInfo tries to
provide this guarantee. However, the CFG can get modified during codegen
in a way that grows the *sum* of the edge weights. This doesn't seem
unreasonable (imagine just adding more blocks all with the default
weight of 16), but it is hard to come up with a case that actually
triggers 32-bit overflow. Fortuately, the single-source GCC build is
good at this. The solution isn't very pretty, but its no worse than the
previous code. We're already summing all of the edge weights on each
query, we can sum them, check for an overflow, compute a scale, and sum
them again.

I've included a *greatly* reduced test case out of the GCC source that
triggers it. It's a pretty lame test, as it clearly is just barely
triggering the overflow. I'd like to have something that is much more
definitive, but I don't understand the fundamental pattern that triggers
an explosion in the edge weight sums.

The buggy code is duplicated within this file. I'll colapse them into
a single implementation in a subsequent commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 08:50:16 +00:00
..
Analysis Don't forget to check FlagNW when determining whether an AddRecExpr will wrap 2011-11-09 07:11:37 +00:00
Archive
Assembler
Bindings/Ocaml
Bitcode
BugPoint
CodeGen Fix an overflow bug in MachineBranchProbabilityInfo. This pass relied on 2011-11-14 08:50:16 +00:00
DebugInfo The dwarf standard says that the only differences between a out-of-line 2011-11-12 01:57:54 +00:00
ExecutionEngine
Feature
Integer
lib
Linker
MC ARM optional size suffix for VLDR/VSTR syntax. 2011-11-11 23:34:43 +00:00
Object
Other
Scripts
TableGen
Transforms Don't try to loop on iterators that are potentially invalidated inside the loop. Fixes PR11361! 2011-11-12 03:09:12 +00:00
Unit
Verifier
CMakeLists.txt
lit.cfg
lit.site.cfg.in
Makefile
Makefile.tests
site.exp.in
TestRunner.sh