r309995 - [coverage] Special-case calls to noreturn functions.

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 21:09:42 PDT 2017


Reverted in r310019.

vedant

> On Aug 3, 2017, at 9:07 PM, Vedant Kumar <vsk at apple.com> wrote:
> 
> Hi Eli,
> 
> I think this commit is breaking the stage2 coverage build for clang:
> http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402 <http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402>
> 
> FAILED: tools/clang/lib/AST/CMakeFiles/clangAST.dir/ItaniumMangle.cpp.o 
> /Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/host-compiler/bin/clang++   -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/lib/AST -I/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/llvm/tools/clang/lib/AST -I/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/llvm/tools/clang/include -Itools/clang/include -Iinclude -I/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -fprofile-instr-generate='/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/clang-build/profiles/%6m.profraw' -fcoverage-mapping -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG    -fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/AST/CMakeFiles/clangAST.dir/ItaniumMangle.cpp.o -MF tools/clang/lib/AST/CMakeFiles/clangAST.dir/ItaniumMangle.cpp.o.d -o tools/clang/lib/AST/CMakeFiles/clangAST.dir/ItaniumMangle.cpp.o -c '/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R at 2/llvm/tools/clang/lib/AST/ItaniumMangle.cpp'
> fatal error: error in backend: File exit not handled before popRegions
> I know I committed r310010 in the same window, but I get the exact same error after disabling the deferred regions patch. If I revert just this commit, there's no crash.
> 
> I haven't root-caused the issue. I did see that the issue is in ItaniumMangle.cpp, and it arises when we try to pop a region which starts here:
> 
> (lldb) p StartLoc.dump(SM)
> (lldb) /src/llvm.org <http://llvm.org/>-coverage-braces/llvm/tools/clang/include/clang/Basic/OpenCLImageTypes.def:46:1 <Spelling=<scratch space>:153:1> 
> 
> I need to revert this temporarily to get the bot going again. If you don't have the time to dig into this, just let me know and I'll take a closer look at what went wrong.
> 
> vedant
> 
>> On Aug 3, 2017, at 3:27 PM, Eli Friedman via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>> 
>> Author: efriedma
>> Date: Thu Aug  3 15:27:36 2017
>> New Revision: 309995
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=309995&view=rev <http://llvm.org/viewvc/llvm-project?rev=309995&view=rev>
>> Log:
>> [coverage] Special-case calls to noreturn functions.
>> 
>> The code after a noreturn call doesn't execute.
>> 
>> The pattern in the testcase is pretty common in LLVM (a switch with
>> a default case that calls llvm_unreachable).
>> 
>> Differential Revision: https://reviews.llvm.org/D36250 <https://reviews.llvm.org/D36250>
>> 
>> 
>> Modified:
>>    cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
>>    cfe/trunk/test/CoverageMapping/switch.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=309995&r1=309994&r2=309995&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=309995&r1=309994&r2=309995&view=diff>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Thu Aug  3 15:27:36 2017
>> @@ -716,6 +716,18 @@ struct CounterCoverageMappingBuilder
>>     terminateRegion(S);
>>   }
>> 
>> +  void VisitCallExpr(const CallExpr *E) {
>> +    extendRegion(E);
>> +    for (const Stmt *Child : E->children())
>> +      this->Visit(Child);
>> +
>> +    // Terminate the region when we hit a noreturn function.
>> +    // (This is helpful dealing with switch statements.)
>> +    QualType CalleeType = E->getCallee()->getType();
>> +    if (getFunctionExtInfo(*CalleeType).getNoReturn())
>> +      terminateRegion(E);
>> +  }
>> +
>>   void VisitWhileStmt(const WhileStmt *S) {
>>     extendRegion(S);
>> 
>> 
>> Modified: cfe/trunk/test/CoverageMapping/switch.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switch.cpp?rev=309995&r1=309994&r2=309995&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switch.cpp?rev=309995&r1=309994&r2=309995&view=diff>
>> ==============================================================================
>> --- cfe/trunk/test/CoverageMapping/switch.cpp (original)
>> +++ cfe/trunk/test/CoverageMapping/switch.cpp Thu Aug  3 15:27:36 2017
>> @@ -97,3 +97,16 @@ int fallthrough(int i) { // CHECK-NEXT:
>>     break;
>>   }
>> }
>> +
>> +void abort(void) __attribute((noreturn));
>> +                   // CHECK: noret
>> +int noret(int x) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+9]]:2
>> +  switch (x) {
>> +  default:         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:12
>> +    abort();
>> +  case 1:         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:13
>> +    return 5;
>> +  case 2:         // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:14
>> +    return 10;
>> +  }
>> +}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170803/2a77e18b/attachment.html>


More information about the cfe-commits mailing list