X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FREADME.txt;h=6d42d812a00bf3753843531996f3021a0d60c792;hb=867fe8570f299a058f155f98646d85cabc27155b;hp=4faf8bcfd419982b438c73c5758e88e8f6840cce;hpb=b1e4eebec03f71f3c891ba384b5992f3d65e3591;p=oota-llvm.git diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 4faf8bcfd41..6d42d812a00 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -2,6 +2,38 @@ Target Independent Opportunities: //===---------------------------------------------------------------------===// +We should recognize idioms for add-with-carry and turn it into the appropriate +intrinsics. This example: + +unsigned add32carry(unsigned sum, unsigned x) { + unsigned z = sum + x; + if (sum + x < x) + z++; + return z; +} + +Compiles to: clang t.c -S -o - -O3 -fomit-frame-pointer -m64 -mkernel + +_add32carry: ## @add32carry + addl %esi, %edi + cmpl %esi, %edi + sbbl %eax, %eax + andl $1, %eax + addl %edi, %eax + ret + +with clang, but to: + +_add32carry: + leal (%rsi,%rdi), %eax + cmpl %esi, %eax + adcl $0, %eax + ret + +with gcc. + +//===---------------------------------------------------------------------===// + Dead argument elimination should be enhanced to handle cases when an argument is dead to an externally visible function. Though the argument can't be removed from the externally visible function, the caller doesn't need to pass it in. @@ -1308,12 +1340,6 @@ void foo (int a, struct T b) simplifylibcalls should do several optimizations for strspn/strcspn: -strcspn(x, "") -> strlen(x) -strcspn("", x) -> 0 -strspn("", x) -> 0 -strspn(x, "") -> strlen(x) -strspn(x, "a") -> strchr(x, 'a')-x - strcspn(x, "a") -> inlined loop for up to 3 letters (similarly for strspn): size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2, @@ -1937,3 +1963,23 @@ bb3: ; preds = %entry ret i32 %b } //===---------------------------------------------------------------------===// + +clang -O3 fails to devirtualize this virtual inheritance case: (GCC PR45875) + +struct c1 {}; +struct c10 : c1{ + virtual void foo (); +}; +struct c11 : c10, c1{ + virtual void f6 (); +}; +struct c28 : virtual c11{ + void f6 (); +}; +void check_c28 () { + c28 obj; + c11 *ptr = &obj; + ptr->f6 (); +} + +//===---------------------------------------------------------------------===//