llvm-6502/include/llvm
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
..
ADT Replace (Lower|Upper)caseString in favor of StringRef's newest methods. 2011-11-06 20:37:06 +00:00
Analysis Fix typo. 2011-11-09 18:53:37 +00:00
Assembly Delete names for unused parameters in inline function definitions in headers, so LLVM users can compile with -Wunused-parameter. PR11257; based on patch by Kevin Harris. 2011-11-04 18:11:56 +00:00
Bitcode Remove some cruft from the BitcodeWriter, while still maintaining backward 2011-11-03 00:14:01 +00:00
CodeGen Fix an overflow bug in MachineBranchProbabilityInfo. This pass relied on 2011-11-14 08:50:16 +00:00
Config Fix typo. 2011-11-10 23:33:18 +00:00
DebugInfo DebugInfo: Add equality operators and default constructor to DILineInfo. 2011-09-21 01:13:16 +00:00
ExecutionEngine Delete names for unused parameters in inline function definitions in headers, so LLVM users can compile with -Wunused-parameter. PR11257; based on patch by Kevin Harris. 2011-11-04 18:11:56 +00:00
MC Remove the pubnames section, no one consumes it. 2011-11-09 05:24:07 +00:00
Object object: Add operator < for SymbolRef and SectionRef. 2011-11-02 19:33:41 +00:00
Support Fix pasto. 2011-11-05 09:45:17 +00:00
TableGen Add NAME Member 2011-10-19 13:04:13 +00:00
Target Fix comment for LegalizeTypeAction enum. 2011-11-13 22:11:24 +00:00
Transforms Add utility to append a function to the list of global constructors. 2011-10-31 23:58:51 +00:00
Argument.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Attributes.h Add the returns_twice attribute to LLVM. 2011-10-03 14:45:37 +00:00
AutoUpgrade.h Initial check in that will auto-upgrade the old EH scheme to the new EH scheme. 2011-08-25 23:22:40 +00:00
BasicBlock.h Remove useless code. 2011-10-20 04:33:44 +00:00
CallGraphSCCPass.h
CallingConv.h Use X86_thiscall calling convention for Win64 as well. 2011-03-03 07:49:07 +00:00
CMakeLists.txt build/cmake: Use tblgen macro directly instead of llvm_tablegen, which just 2011-11-04 19:04:23 +00:00
Constant.h Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api. 2011-08-24 20:18:38 +00:00
Constants.h Constify Comparison 2011-08-25 20:18:22 +00:00
DebugInfoProbe.h Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is treating debugging information. 2011-03-10 00:21:25 +00:00
DefaultPasses.h Add a couple missing includes; found while analyzing LLVM headers. 2011-11-04 18:19:43 +00:00
DerivedTypes.h Rip out the old StructType APIs as warned about on llvmdev last week. 2011-08-18 17:39:28 +00:00
Function.h Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180. 2011-10-20 05:23:42 +00:00
GlobalAlias.h Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding its 2011-08-22 09:37:03 +00:00
GlobalValue.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
GlobalVariable.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
GVMaterializer.h
InitializePasses.h Prune more RALinScan. RALinScan was also here! 2011-11-13 01:33:10 +00:00
InlineAsm.h Encode register class constreaints in inline asm instructions. 2011-10-12 23:37:29 +00:00
InstrTypes.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Instruction.def Initial commit of the 'landingpad' instruction. 2011-08-12 20:24:12 +00:00
Instruction.h Fix AliasSetTracker so that it doesn't make any assumptions about instructions it doesn't know about (like the atomic instructions I'm adding). 2011-07-27 00:46:46 +00:00
Instructions.h Add a routine to swap branch instruction operands, and update any 2011-10-17 01:11:57 +00:00
IntrinsicInst.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Intrinsics.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Intrinsics.td Remove the Alpha backend. 2011-10-27 22:56:32 +00:00
IntrinsicsARM.td Add support for ARM ldrexd/strexd intrinsics. They both use i32 register pairs 2011-05-28 04:07:29 +00:00
IntrinsicsCellSPU.td
IntrinsicsPowerPC.td
IntrinsicsPTX.td PTX: Add intrinsics to list of built-in intrinsics, which allows them to be 2011-04-20 15:37:17 +00:00
IntrinsicsX86.td Add AVX2 variable shift instructions and intrinsics. 2011-11-07 08:26:24 +00:00
IntrinsicsXCore.td Update IntrinsicsXCore.td with the normal LLVM notice at the top of the file. 2011-10-13 21:08:11 +00:00
LinkAllPasses.h Remove the old tail duplication pass. It is not used and is unable to update 2011-08-30 23:03:45 +00:00
LinkAllVMCore.h Missed a spot removing Alarm. 2010-12-07 18:50:33 +00:00
Linker.h Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before. 2011-10-11 00:24:54 +00:00
LLVMContext.h Add a pinned metadata name for fpaccuracy, and document it 2011-10-27 19:19:14 +00:00
Metadata.h Typos. 2011-06-01 23:32:40 +00:00
Module.h Remove the last improper use of getGlobalContext() from LLVM. 2011-08-13 01:04:44 +00:00
OperandTraits.h Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding its 2011-08-22 09:37:03 +00:00
Operator.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Pass.h Fix typos in comments. 2011-04-28 09:12:47 +00:00
PassAnalysisSupport.h Add a couple missing includes; found while analyzing LLVM headers. 2011-11-04 18:19:43 +00:00
PassManager.h
PassManagers.h Reapply r138695. Fix PassManager stack depths. 2011-08-29 17:07:00 +00:00
PassRegistry.h Attempt to fix valgrind complaining about (benign) leaks in pass registration by having PassRegistry 2010-10-20 22:22:30 +00:00
PassSupport.h Revert r131155 for now. It makes VMCore depend on Analysis and Transforms 2011-05-10 22:16:06 +00:00
SymbolTableListTraits.h
Type.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Use.h Reinstate r133513 (reverted in r133700) with an additional fix for a 2011-06-23 09:09:15 +00:00
User.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
Value.h Typo. 2011-08-11 00:22:48 +00:00
ValueSymbolTable.h Merge System into Support. 2010-11-29 18:16:10 +00:00