[llvm] r262510 - Add another test for the GlobalOpt change in r212079.

Bob Wilson via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 12:02:25 PST 2016


Author: bwilson
Date: Wed Mar  2 14:02:25 2016
New Revision: 262510

URL: http://llvm.org/viewvc/llvm-project?rev=262510&view=rev
Log:
Add another test for the GlobalOpt change in r212079.

This is a test that Akira Hatanaka wrote to test GlobalOpt's handling of
aliases with GEP operands. David Majnemer independently made the same
change to GlobalOpt in r212079. Akira's test is a useful addition, so I'm
pulling it over from the llvm repo for Swift on GitHub.

Modified:
    llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll

Modified: llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll?rev=262510&r1=262509&r2=262510&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/alias-used.ll Wed Mar  2 14:02:25 2016
@@ -45,3 +45,22 @@ define i8* @g2() {
 define i8* @h() {
   ret i8* @ca
 }
+
+; Check that GlobalOpt doesn't try to resolve aliases with GEP operands.
+
+%struct.S = type { i32, i32, i32 }
+ at s = global %struct.S { i32 1, i32 2, i32 3 }, align 4
+
+ at alias1 = alias i32, i32* getelementptr inbounds (%struct.S, %struct.S* @s, i64 0, i32 1)
+ at alias2 = alias i32, i32* getelementptr inbounds (%struct.S, %struct.S* @s, i64 0, i32 2)
+
+; CHECK: load i32, i32* @alias1, align 4
+; CHECK: load i32, i32* @alias2, align 4
+
+define i32 @foo1() {
+entry:
+  %0 = load i32, i32* @alias1, align 4
+  %1 = load i32, i32* @alias2, align 4
+  %add = add nsw i32 %1, %0
+  ret i32 %add
+}




More information about the llvm-commits mailing list