Here's a mildly insane test case reduced from mozilla. $ cat t.cc #define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall)) struct nsCOMPtr_base { NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base() {} }; struct nsCOMPtr : private nsCOMPtr_base {}; int main() { nsCOMPtr ptr; } $ clang -target i386-linux-gnu -O1 -Xclang -disable-llvm-optzns -flto -S -o - t.cc define i32 @main() #0 { entry: %ptr = alloca %struct.nsCOMPtr, align 1 call void bitcast (void (%struct.nsCOMPtr_base*)* @_ZN13nsCOMPtr_baseD2Ev to void (%struct.nsCOMPtr*)*)(%struct.nsCOMPtr* %ptr) ret i32 0 } define linkonce_odr x86_stdcallcc void @_ZN13nsCOMPtr_baseD2Ev(%struct.nsCOMPtr_base* inreg %this) Here we create a call to @_ZN13nsCOMPtr_baseD2Ev without adding the x86_stdcallcc attribute to the call. The optimizer will turn this into a call to @llvm.trap.
fixed in r203007 .