[PATCH] [CodeGenPrepare] Move extractelement close to store if they can be combined.

hfinkel at anl.gov hfinkel at anl.gov
Tue Oct 28 07:21:52 PDT 2014


> However, I haven’t used the fast information with the store alignment. Indeed, I am not sure this gets us anything. This will tell us whether or not a store is slow, but since we are not changing the type of the store, this does not tell us if we are slowing down the code or if the combine is still supported.
> We could assume "slow store" == "no combine”, but I prefer, like you said, that we wait for actual use cases to start doing heuristic in this domain.
> 
> Thoughts?

I agree. Thinking about it, checking Fast is actually not really right (Fast == false likely indicates that the actual unaligned case is handled by some OS trap handler, for example, which really has nothing to do with instruction selection, and hurts the case where the data is actually aligned).

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3280
@@ +3279,3 @@
+      // the extract with the store.
+      if (Align < ABIAlignment)
+        return false;
----------------
Why are you also checking against the ABI alignment?

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3367
@@ +3366,3 @@
+    case Instruction::FRem:
+      return !Use->hasUnsafeAlgebra();
+    }
----------------
This should be !Use->hasNoNaNs(); (I'd like to keep us from over-generalizing these kinds of checks and just using 'unsafe algebra' for everything -- we can be more specific here).

http://reviews.llvm.org/D5921






More information about the llvm-commits mailing list