Changeset 1506:76936858d1c6
- Timestamp:
- 06/20/09 05:39:13
(4 years ago)
- Author:
- Frits van Bommel <fvbommel wxs.nl>
- branch:
- default
- Message:
Return void* from _d_allocclass so LLVM doesn't do weird things with it...
This allows -instcombine followed by -gvn to do devirtualization, so add
-gvn in strategic places in the default pass order.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1492 |
r1506 |
|
| 136 | 136 | addPass(pm, createTailCallEliminationPass()); |
|---|
| 137 | 137 | addPass(pm, createCFGSimplificationPass()); |
|---|
| | 138 | addPass(pm, createGVNPass()); |
|---|
| 138 | 139 | } |
|---|
| 139 | 140 | |
|---|
| … | … | |
| 146 | 147 | addPass(pm, createScalarReplAggregatesPass()); |
|---|
| 147 | 148 | addPass(pm, createInstructionCombiningPass()); |
|---|
| 148 | | |
|---|
| 149 | | // Inline again, to catch things like foreach delegates |
|---|
| 150 | | // passed to inlined opApply's where the function wasn't |
|---|
| 151 | | // known during the first inliner pass. |
|---|
| | 149 | // -instcombine + gvn == devirtualization :) |
|---|
| | 150 | addPass(pm, createGVNPass()); |
|---|
| | 151 | |
|---|
| | 152 | // Inline again, to catch things like now nonvirtual |
|---|
| | 153 | // function calls, foreach delegates passed to inlined |
|---|
| | 154 | // opApply's, etc. where the actual function being called |
|---|
| | 155 | // wasn't known during the first inliner pass. |
|---|
| 152 | 156 | addPass(pm, createFunctionInliningPass()); |
|---|
| 153 | 157 | |
|---|
| r1485 |
r1506 |
|
| 330 | 330 | std::vector<const LLType*> types; |
|---|
| 331 | 331 | types.push_back(classInfoTy); |
|---|
| 332 | | const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false); |
|---|
| | 332 | const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); |
|---|
| 333 | 333 | llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) |
|---|
| 334 | 334 | ->setAttributes(Attr_NoAlias); |
|---|
| r1440 |
r1506 |
|
| 108 | 108 | * |
|---|
| 109 | 109 | */ |
|---|
| 110 | | extern (C) Object _d_allocclass(ClassInfo ci) |
|---|
| | 110 | extern (C) void* _d_allocclass(ClassInfo ci) |
|---|
| 111 | 111 | { |
|---|
| 112 | 112 | void* p; |
|---|
| … | … | |
| 151 | 151 | |
|---|
| 152 | 152 | debug(PRINTF) printf("initialization done\n"); |
|---|
| 153 | | return cast(Object) p; |
|---|
| | 153 | return p; |
|---|
| 154 | 154 | } |
|---|
| 155 | 155 | |
|---|