This is an archive of the discontinued LLVM Phabricator instance.

Create a new attribute set when the definition is parsed after a declaration of a function
ClosedPublic

Authored by ahatanak on Sep 21 2015, 1:42 AM.

Details

Summary

An assert is triggered when the test case program is compiled with -Oz:

Assertion failed: (!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) && "OptimizeNone and OptimizeForSize on same function!"), function SetLLVMFunctionAttributesForDefinition, file /Users/ahatanaka/projects/llvm/git/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp, line 831.

This patch fixes the assert by clearing the attribute set attached to IR function foo1 and creating it again when the function's definition is parsed.

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak updated this revision to Diff 35214.Sep 21 2015, 1:42 AM
ahatanak retitled this revision from to Create a new attribute set when the definition is parsed after a declaration of a function.
ahatanak updated this object.
ahatanak added a subscriber: cfe-commits.
vsk added a subscriber: vsk.Sep 21 2015, 7:46 AM

Thanks, LGTM.

This revision was automatically updated to reflect the committed changes.