[llvm-commits] [llvm] r55763 - in /llvm/trunk: lib/Target/X86/X86FastISel.cpp test/CodeGen/X86/fast-isel-mem.ll test/CodeGen/X86/fast-isel.ll
Evan Cheng
evan.cheng at apple.com
Wed Sep 3 23:18:34 PDT 2008
Author: evancheng
Date: Thu Sep 4 01:18:33 2008
New Revision: 55763
URL: http://llvm.org/viewvc/llvm-project?rev=55763&view=rev
Log:
Load from GV stub should be locally CSE'd.
Added:
llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll
Modified:
llvm/trunk/lib/Target/X86/X86FastISel.cpp
llvm/trunk/test/CodeGen/X86/fast-isel.ll
Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=55763&r1=55762&r2=55763&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Sep 4 01:18:33 2008
@@ -71,6 +71,8 @@
X86AddressMode AM;
AM.GV = GV;
addFullAddress(BuildMI(MBB, TII.get(Opc), Op0), AM);
+ // Prevent loading GV stub multiple times in same MBB.
+ LocalValueMap[V] = Op0;
}
return true;
}
Added: llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll?rev=55763&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll (added)
+++ llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll Thu Sep 4 01:18:33 2008
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -fast-isel -mtriple=i386-apple-darwin -mattr=sse2 | \
+; RUN: grep mov | grep lazy_ptr | count 1
+
+ at src = external global i32
+
+define i32 @loadgv() nounwind {
+entry:
+ %0 = load i32* @src, align 4
+ %1 = load i32* @src, align 4
+ %2 = add i32 %0, %1
+ ret i32 %2
+}
Modified: llvm/trunk/test/CodeGen/X86/fast-isel.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel.ll?rev=55763&r1=55762&r2=55763&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fast-isel.ll Thu Sep 4 01:18:33 2008
@@ -47,11 +47,3 @@
%tmp2 = bitcast i32 0 to i32
ret i32 %tmp2
}
-
- at src = external global i32
-
-define i32 @loadgv() nounwind {
-entry:
- %0 = load i32* @src, align 4
- ret i32 %0
-}
More information about the llvm-commits
mailing list