[PATCH] D21271: Fix `InstCombine` to not widen metadata on store-to-load forwarding

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 12 15:21:10 PDT 2016


eli.friedman added a subscriber: eli.friedman.
eli.friedman added a comment.

In the CSE case, we aren't guaranteed that the metadata on the first load makes sense: the optimizer is allowed to insert a load anywhere with any metadata as long as it can guarantee it's safe to dereference.  So we have to merge the metadata to ensure correct behavior.  (Realistically, we might end up in this situation by hoisting a dead load.)

----

While you're in the area, would you mind fixing JumpThreading as well?  (If you don't have time, I'll just file a bug instead.)


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:827
@@ -826,1 +826,3 @@
+    if (IsLoadCSE) {
+      LoadInst *NLI = static_cast<LoadInst*>(AvailableVal);
       unsigned KnownIDs[] = {
----------------
Nit: "cast<LoadInst>()".


http://reviews.llvm.org/D21271





More information about the llvm-commits mailing list