[PATCH] GlobalOpt: Don't optimize dllimport for initializers
Reid Kleckner
rnk at google.com
Mon Jun 23 12:36:31 PDT 2014
================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:1987-1988
@@ -1987,1 +1986,4 @@
+
+ // Simple integer, undef, constant aggregate zero, etc are all supported.
+ if (C->getNumOperands() == 0 || isa<BlockAddress>(C))
return true;
----------------
IMO getNumOperands() == 0 is the common case (ints), so I'd put that check first.
================
Comment at: test/Transforms/GlobalOpt/constantfold-initializers.ll:55-62
@@ +54,10 @@
+
+ at dllexportptr = global i32* null, align 4
+; CHECK-NOT: @dllexportptr = global i32* @dllexportvar, align 4
+ at dllexportvar = external dllimport global i32
+define internal void @test3() {
+entry:
+ store i32* @dllexportvar, i32** @dllexportptr, align 4
+ ret void
+}
+
----------------
Why are these all called dllexport-stuff? It seems like dllimport would be the better naming.
Can you add a test to verify that globalopt fires on dllexport data? Based on the comment you fixed, it seems like it didn't used to.
================
Comment at: test/Transforms/GlobalOpt/constantfold-initializers.ll:56
@@ +55,3 @@
+ at dllexportptr = global i32* null, align 4
+; CHECK-NOT: @dllexportptr = global i32* @dllexportvar, align 4
+ at dllexportvar = external dllimport global i32
----------------
IMO a positive CHECK line for "@dllexport = global i32* null" would make a better test.
http://reviews.llvm.org/D4249
More information about the llvm-commits
mailing list