Add a totally synthetic situation I came up with while looking at a bug in
authorNick Lewycky <nicholas@mxc.ca>
Wed, 25 Feb 2009 06:52:48 +0000 (06:52 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 25 Feb 2009 06:52:48 +0000 (06:52 +0000)
related code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65437 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/README.txt

index 09e5433578cca167a85d32f1a0d680452ee0b237..341c5c1ff472f9f683fbc87384b4a44b9b0a2bc1 100644 (file)
@@ -1690,6 +1690,7 @@ For example: store of float into { {{}}, float } could be turned into a store to
 the float directly.
 
 //===---------------------------------------------------------------------===//
+
 #include <math.h>
 double foo(double a) {    return sin(a); }
 
@@ -1704,3 +1705,19 @@ vs:
 foo:
         jmp sin
 
+//===---------------------------------------------------------------------===//
+
+Instcombine should replace the load with a constant in:
+
+  static const char x[4] = {'a', 'b', 'c', 'd'};
+  
+  unsigned int y(void) {
+    return *(unsigned int *)x;
+  }
+
+It currently only does this transformation when the size of the constant 
+is the same as the size of the integer (so, try x[5]) and the last byte 
+is a null (making it a C string). There's no need for these restrictions.
+
+//===---------------------------------------------------------------------===//
+