[cfe-commits] r108469 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/available-externally-suppress.c

Douglas Gregor dgregor at apple.com
Thu Jul 15 16:04:59 PDT 2010


On Jul 15, 2010, at 4:04 PM, Eli Friedman wrote:

> On Thu, Jul 15, 2010 at 3:58 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Thu Jul 15 17:58:18 2010
>> New Revision: 108469
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=108469&view=rev
>> Log:
>> Don't suppress the emission of available_externally functions marked
>> with always_inline attribute. Thanks to Howard for the tip.
>> 
>> Modified:
>>    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>    cfe/trunk/test/CodeGen/available-externally-suppress.c
>> 
>> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=108469&r1=108468&r2=108469&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jul 15 17:58:18 2010
>> @@ -816,7 +816,8 @@
>>   if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
>>     // At -O0, don't generate IR for functions with available_externally
>>     // linkage.
>> -    if (CodeGenOpts.OptimizationLevel == 0 &&
>> +    if (CodeGenOpts.OptimizationLevel == 0 &&
>> +        !Function->hasAttr<AlwaysInlineAttr>() &&
>>         getFunctionLinkage(Function)
>>                                   == llvm::Function::AvailableExternallyLinkage)
>>       return;
>> 
>> Modified: cfe/trunk/test/CodeGen/available-externally-suppress.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/available-externally-suppress.c?rev=108469&r1=108468&r2=108469&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGen/available-externally-suppress.c (original)
>> +++ cfe/trunk/test/CodeGen/available-externally-suppress.c Thu Jul 15 17:58:18 2010
>> @@ -10,3 +10,17 @@
>>  void test() {
>>   f0(17);
>>  }
>> +
>> +inline int __attribute__((always_inline)) f1(int x) {
>> +  int blarg = 0;
>> +  for (int i = 0; i < x; ++i)
>> +    blarg = blarg + x * i;
>> +  return blarg;
>> +}
>> +
>> +int test1(int x) {
>> +  // CHECK: br i1
>> +  // CHECK-NOT: call
>> +  // CHECK: ret i32
>> +  return f1(x);
>> +}
> 
> It would be a good idea to put a "CHECK: @test1" in here...

Yep, you're right. Thanks Eli! r108470.

	- Doug





More information about the cfe-commits mailing list