[llvm-commits] [llvm] r52254 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/2008-06-13-NotVolatileLoadStore.ll test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll

Duncan Sands baldrick at free.fr
Sat Jun 14 10:41:22 PDT 2008


Hi Evan,

> Is it possible to ever transform volatile instructions?

if a volatile instruction is illegal then it has to be transformed
to legalize it.  But I guess you were talking of the DAG combiner.
On x86-32, changing a volatile load/store of i32 into a volatile
load/store of f32 or vice-versa should be completely harmless.

Here's a list of transforms that we do for volatile load/store
as long as the final operation is legal:

  // fold (zext_inreg (extload x)) -> (zextload x)
  // fold (zext_inreg (sextload x)) -> (zextload x) iff load has one use
  // fold (sext (load x)) -> (sext (truncate (sextload x)))
  // fold (sext (sextload x)) -> (sext (truncate (sextload x)))
  // fold (sext ( extload x)) -> (sext (truncate (sextload x)))
  // fold (zext (load x)) -> (zext (truncate (zextload x)))
  // fold (zext (zextload x)) -> (zext (truncate (zextload x)))
  // fold (zext ( extload x)) -> (zext (truncate (zextload x)))
  // fold (aext (load x)) -> (aext (truncate (extload x)))
  // fold (aext (zextload x)) -> (aext (truncate (zextload x)))
  // fold (aext (sextload x)) -> (aext (truncate (sextload x)))
  // fold (aext ( extload x)) -> (aext (truncate (extload  x)))
  // fold (sext_inreg (extload x)) -> (sextload x)
  // fold (sext_inreg (zextload x)) -> (sextload x) iff load has one use
  // fold (fpext (load x)) -> (fpext (fptrunc (extload x)))

  // If this is a store of a bit convert, store the input value if the
  // resultant store does not need a higher alignment than the original.

  // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
  // "truncstore (or (shl x, 8), y), i8"  -> "truncstore y, i8"

  // If this is an FP_ROUND or TRUNC followed by a store, fold this into a
  // truncating store.  We can do this even if this is already a truncstore.

These all seem harmless to me, however I doubt anyone would care
if they were turned off.

> Would it make   
> sense to preprocess all nodes and add any that should never be  
> modified into a  set? All uses of these nodes can also be added to the  
> set. DAG combiner should never add these nodes to its worklist. Would  
> this reduce complexity and / or runtime of dag combiner?

Does the DAG combiner ever look deeper than one use?  Otherwise I guess
this would work.

> Just thinking out aloud. The idea is probably overly conservative but  
> it would be nice to move all such checks to a central place.

I'm not sure it is overly conservative - in this area it is best to be
conservative.

Ciao,

Duncan.



More information about the llvm-commits mailing list