[PATCH] Don't Promote x86_fp80 byval Pointer Arguments

Reid Kleckner rnk at google.com
Wed Aug 27 14:10:06 PDT 2014


Almost there, I think.

================
Comment at: lib/Transforms/IPO/ArgumentPromotion.cpp:132
@@ +131,3 @@
+// hasPadding - This method checks to see if a type could have padding bytes
+bool ArgPromotion::isDenselyPacked(Type *type) {
+
----------------
David, is there an easier way to write this function in LLVM? You are more familiar with writing optimizations.

================
Comment at: lib/Transforms/IPO/ArgumentPromotion.cpp:175
@@ +174,3 @@
+  // very hard to make guarantees about which offsets are accessed
+  if (PointerMayBeCaptured(arg, true, true)) return true;
+
----------------
This seems like an expensive duplication of the work you do below.

================
Comment at: lib/Transforms/IPO/ArgumentPromotion.cpp:186-187
@@ +185,4 @@
+      WorkList.insert(WorkList.end(), V->user_begin(), V->user_end());
+    else if (!isa<LoadInst>(V) && !isa<StoreInst>(V))
+      return true;
+  }
----------------
You need to check that V is the target of the load or store, and not the value being loaded or stored. Adding this check should subsume PointerMayBeCaptured. We should have a test case where we store the address of a byval parameter to a global, for example.

http://reviews.llvm.org/D5057






More information about the llvm-commits mailing list