[cfe-commits] r110864 - in /cfe/trunk: lib/CodeGen/CodeGenFunction.cpp test/CodeGen/unwind-attr.c
Chris Lattner
clattner at apple.com
Wed Aug 11 18:01:03 PDT 2010
On Aug 11, 2010, at 3:38 PM, John McCall wrote:
> Author: rjmccall
> Date: Wed Aug 11 17:38:33 2010
> New Revision: 110864
>
> URL: http://llvm.org/viewvc/llvm-project?rev=110864&view=rev
> Log:
> Revise r110163: don't mark weak functions nounwind, because the optimizer
> treats that as a contract to be fulfilled by any replacements.
Really? That sounds like an optimizer bug. Nothing about a 'weak' function should be assumed to hold. It sounds like something (the pruneeh pass?) isn't using GlobalValue::mayBeOverridden in the right place.
-Chris
>
>
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> cfe/trunk/test/CodeGen/unwind-attr.c
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=110864&r1=110863&r2=110864&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Aug 11 17:38:33 2010
> @@ -315,6 +315,10 @@
> /// non-existence of any throwing calls within it. We believe this is
> /// lightweight enough to do at -O0.
> static void TryMarkNoThrow(llvm::Function *F) {
> + // LLVM treats 'nounwind' on a function as part of the type, so we
> + // can't do this on functions that can be overwritten.
> + if (F->mayBeOverridden()) return;
> +
> for (llvm::Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
> for (llvm::BasicBlock::iterator
> BI = FI->begin(), BE = FI->end(); BI != BE; ++BI)
>
> Modified: cfe/trunk/test/CodeGen/unwind-attr.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/unwind-attr.c?rev=110864&r1=110863&r2=110864&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/unwind-attr.c (original)
> +++ cfe/trunk/test/CodeGen/unwind-attr.c Wed Aug 11 17:38:33 2010
> @@ -15,3 +15,10 @@
> int test1(void) {
> return 0;
> }
> +
> +// <rdar://problem/8283071>: not for weak functions
> +// CHECK: define weak [[INT:i.*]] @test2() {
> +// CHECK-NOEXC: define weak [[INT:i.*]] @test2() nounwind {
> +__attribute__((weak)) int test2(void) {
> + return 0;
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list