1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/include/llvm
Duncan Sands 40c8db881a Disable some DAG combiner optimizations that may be
wrong for volatile loads and stores.  In fact this
is almost all of them!  There are three types of
problems: (1) it is wrong to change the width of
a volatile memory access.  These may be used to
do memory mapped i/o, in which case a load can have
an effect even if the result is not used.  Consider
loading an i32 but only using the lower 8 bits.  It
is wrong to change this into a load of an i8, because
you are no longer tickling the other three bytes.  It
is also unwise to make a load/store wider.  For
example, changing an i16 load into an i32 load is
wrong no matter how aligned things are, since the
fact of loading an additional 2 bytes can have
i/o side-effects.  (2) it is wrong to change the
number of volatile load/stores: they may be counted
by the hardware.  (3) it is wrong to change a volatile
load/store that requires one memory access into one
that requires several.  For example on x86-32, you
can store a double in one processor operation, but to
store an i64 requires two (two i32 stores).  In a
multi-threaded program you may want to bitcast an i64
to a double and store as a double because that will
occur atomically, and be indivisible to other threads.
So it would be wrong to convert the store-of-double
into a store of an i64, because this will become two
i32 stores - no longer atomic.  My policy here is
to say that the number of processor operations for
an illegal operation is undefined.  So it is alright
to change a store of an i64 (requires at least two
stores; but could be validly lowered to memcpy for
example) into a store of double (one processor op).
In short, if the new store is legal and has the same
size then I say that the transform is ok.  It would
also be possible to say that transforms are always
ok if before they were illegal, whether after they
are illegal or not, but that's more awkward to do
and I doubt it buys us anything much.
However this exposed an interesting thing - on x86-32
a store of i64 is considered legal!  That is because
operations are marked legal by default, regardless of
whether the type is legal or not.  In some ways this
is clever: before type legalization this means that
operations on illegal types are considered legal;
after type legalization there are no illegal types
so now operations are only legal if they really are.
But I consider this to be too cunning for mere mortals.
Better to do things explicitly by testing AfterLegalize.
So I have changed things so that operations with illegal
types are considered illegal - indeed they can never
map to a machine operation.  However this means that
the DAG combiner is more conservative because before
it was "accidentally" performing transforms where the
type was illegal because the operation was nonetheless
marked legal.  So in a few such places I added a check
on AfterLegalize, which I suppose was actually just
forgotten before.  This causes the DAG combiner to do
slightly more than it used to, which resulted in the X86
backend blowing up because it got a slightly surprising
node it wasn't expecting, so I tweaked it.

llvm-svn: 52254
2008-06-13 19:07:40 +00:00
..
ADT Remove some DAG combiner assumptions about sizes 2008-06-09 11:32:28 +00:00
Analysis Crash less. The i64 restriction in BinomialCoefficient caused some problems 2008-06-13 04:38:55 +00:00
Assembly Revert 51775. 2008-05-30 22:47:19 +00:00
Bitcode For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h" 2008-05-29 17:41:17 +00:00
CodeGen Sometimes (rarely) nodes held in LegalizeTypes 2008-06-11 11:42:12 +00:00
Config Use C-style comments :) 2008-03-23 13:44:17 +00:00
Debugger Fix more -Wshorten-64-to-32 warnings. 2008-05-05 18:30:58 +00:00
ExecutionEngine Fix a couple issues with the JIT and multiple modules: 2008-05-21 16:34:48 +00:00
Support * Make CallSite::hasArgument const and let it take a const parameter. 2008-06-05 08:04:58 +00:00
System Prune and tidy #includes. 2008-05-29 19:52:31 +00:00
Target Disable some DAG combiner optimizations that may be 2008-06-13 19:07:40 +00:00
Transforms Revert 51775. 2008-05-30 22:47:19 +00:00
AbstractTypeUser.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
Argument.h Expose parameter attributes via C bindings. 2008-04-28 17:37:06 +00:00
AutoUpgrade.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
BasicBlock.h For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h" 2008-05-29 17:41:17 +00:00
CallGraphSCCPass.h PassInfo keep tracks whether a pass is an analysis pass or not. 2008-03-19 21:56:59 +00:00
CallingConv.h Implement sseregparm. 2008-02-05 20:46:33 +00:00
Constant.h Remove warnings about unused parameters and shadowed variables. 2008-05-19 20:15:12 +00:00
Constants.h IR, bitcode reader, bitcode writer, and asmparser changes to 2008-05-31 00:58:22 +00:00
DerivedTypes.h Remove unused parameter. Some clients might use -Werror when compiling and 2008-06-05 07:24:08 +00:00
Function.h Factor code to copy global value attributes like 2008-05-26 19:58:59 +00:00
GlobalAlias.h merge of use-diet branch to trunk 2008-05-10 08:32:32 +00:00
GlobalValue.h Factor code to copy global value attributes like 2008-05-26 19:58:59 +00:00
GlobalVariable.h Factor code to copy global value attributes like 2008-05-26 19:58:59 +00:00
InlineAsm.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
InstrTypes.h make ExtractValueInst derived from UnaryInstruction 2008-06-06 20:28:12 +00:00
Instruction.def IR support for extractvalue and insertvalue instructions. Also, begin 2008-05-15 19:50:34 +00:00
Instruction.h merge of use-diet branch to trunk 2008-05-10 08:32:32 +00:00
Instructions.h get rid of ExtractValueInst::init's Value argument, it is already passed to the UnaryInstruction ctor 2008-06-06 21:06:32 +00:00
IntrinsicInst.h Turn StripPointerCast() into a method 2008-05-07 22:54:15 +00:00
Intrinsics.h add missing #include 2008-04-30 04:56:14 +00:00
Intrinsics.td Added addition atomic instrinsics and, or, xor, min, and max. 2008-05-05 19:05:59 +00:00
IntrinsicsARM.td remove attribution from a variety of miscellaneous files. 2007-12-29 22:59:10 +00:00
IntrinsicsCellSPU.td Final de-tabification. 2008-02-27 06:33:05 +00:00
IntrinsicsPowerPC.td remove attribution from a variety of miscellaneous files. 2007-12-29 22:59:10 +00:00
IntrinsicsX86.td Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq. 2008-05-24 02:56:30 +00:00
LinkAllPasses.h Force postdom to be linked into opt and bugpoint, even though it is no longer used by any passes. 2008-05-29 17:00:13 +00:00
LinkAllVMCore.h prune unneeded #includes 2008-04-01 04:00:45 +00:00
Linker.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
LinkTimeOptimizer.h Add CommonLinkage. 2008-05-16 22:42:11 +00:00
Module.h Fix comment. 2008-04-16 20:45:31 +00:00
ModuleProvider.h Remove warnings about unused parameters and shadowed variables. 2008-05-19 20:15:12 +00:00
OperandTraits.h add doxygen comments 2008-05-29 22:58:33 +00:00
ParameterAttributes.h Fix more -Wshorten-64-to-32 warnings. 2008-05-05 18:30:58 +00:00
Pass.h Remove warnings about unused parameters and shadowed variables. 2008-05-19 20:15:12 +00:00
PassAnalysisSupport.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
PassManager.h Give PassManager and FunctionPassManager a common base class, with 2008-03-11 16:41:42 +00:00
PassManagers.h Add #includes to make some dependencies explicit. 2008-05-23 20:40:06 +00:00
PassSupport.h Remove warnings about unused parameters and shadowed variables. 2008-05-19 20:15:12 +00:00
SymbolTableListTraits.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
Type.h Add an isAggregateType predicate. 2008-05-30 22:40:06 +00:00
TypeSymbolTable.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
Use.h For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h" 2008-05-29 17:41:17 +00:00
User.h op_iterator-ify dropAllReferences 2008-06-11 11:45:26 +00:00
Value.h Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block. 2008-06-12 21:15:59 +00:00
ValueSymbolTable.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00