[PATCH] D25849: [GVN] Prevent load coercion with irregular vector types

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 17:48:49 PDT 2016

reames added inline comments.

Comment at: lib/Transforms/Scalar/GVN.cpp:721
+  // going to crash later anyway.
+  if (llvm::alignTo(StoreSize, 8) != StoreSize)
+    return false;
StoreSize % 8 == 0 would seem to be a more standard way to express this check.

Also, checking only the StoreSize seems suspect.  Why do we not need to test the load size?

Comment at: lib/Transforms/Scalar/GVN.cpp:783
          "CanCoerceMustAliasedValueToLoad fail");
   // Convert source pointers to integers, which can be manipulated.
Have you looked at what's required to fix this code path?  This should be the only logic protected by the predicate you're modifying.

Comment at: test/Transforms/GVN/i7vector.ll:7
+  store <7 x i1> undef, <7 x i1>* %a, align 2
+  %0 = getelementptr inbounds <7 x i1>, <7 x i1>* %a, i64 0, i64 0
+  %val = load i1, i1* %0, align 2
Using a bitcast might be more canonical here.


More information about the llvm-commits mailing list