[llvm-commits] [llvm] r122966 - /llvm/trunk/lib/Target/README.txt
Benjamin Kramer
benny.kra at googlemail.com
Thu Jan 6 09:35:50 PST 2011
Author: d0k
Date: Thu Jan 6 11:35:50 2011
New Revision: 122966
URL: http://llvm.org/viewvc/llvm-project?rev=122966&view=rev
Log:
Add a note from llvmdev, this time with more info.
Modified:
llvm/trunk/lib/Target/README.txt
Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=122966&r1=122965&r2=122966&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Thu Jan 6 11:35:50 2011
@@ -2047,3 +2047,29 @@
}
//===---------------------------------------------------------------------===//
+clang -O3 currently compiles this code
+
+int g(unsigned int a) {
+ unsigned int c[100];
+ c[10] = a;
+ c[11] = a;
+ unsigned int b = c[10] + c[11];
+ if(b > a*2) a = 4;
+ else a = 8;
+ return a + 7;
+}
+
+into
+
+define i32 @g(i32 a) nounwind readnone {
+ %add = shl i32 %a, 1
+ %mul = shl i32 %a, 1
+ %cmp = icmp ugt i32 %add, %mul
+ %a.addr.0 = select i1 %cmp, i32 11, i32 15
+ ret i32 %a.addr.0
+}
+
+The icmp should fold to false. This CSE opportunity is only available
+after GVN and InstCombine have run.
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list