[PATCH] Don't Promote x86_fp80 byval Pointer Arguments

Reid Kleckner rnk at google.com
Mon Aug 25 20:16:44 PDT 2014


================
Comment at: lib/Transforms/IPO/ArgumentPromotion.cpp:191
@@ -190,1 +190,3 @@
+          Type *ElTy = STy->getElementType(i);
+          if (!ElTy->isSingleValueType() || ElTy->isX86_FP80Ty()) {
             AllSimple = false;
----------------
I think this code needs to handle this case as well:
  %struct.Foo = type { i32, i64 }
  define internal i64 @foo(%struct.Foo* byval %a) {
    %p = bitcast %struct.Foo* %a to i64*
    %v = load i64* %p
    ret i64 %v
  }

In retrospect, the size comparison was probably correct. I just didn't realize that we fell back to the usual promotion checks that would allow us to promote the simple, castless cases.

================
Comment at: test/Transforms/ArgumentPromotion/fp80.ll:18
@@ +17,3 @@
+
+; CHECK-NOT: @foo(x86_fp80
+; Function Attrs: noinline nounwind uwtable
----------------
I recommend writing positive test cases when possible, so that the test case doesn't silently break. For example, if someone renamed @foo without fixing the CHECK we wouldn't know. That's contrived, but there are other cases. The negative grep tests in particular have proven to be not very useful. You can probably look for all of:
  ; CHECK: define internal fastcc void @foo(%union.u* byval

http://reviews.llvm.org/D5057






More information about the llvm-commits mailing list