Skip to content

Commit

Permalink
Revert "Disable targetdatalayoutcheck"
Browse files Browse the repository at this point in the history
I committed by accident a local hack that should not have made it upstream.
Sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245212 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
tobiasgrosser committed Aug 17, 2015
1 parent 79224a7 commit 378e97e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/llvm/Target/TargetMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ class TargetMachine {
/// Create a DataLayout.
const DataLayout createDataLayout() const { return DL; }

/// Test if a DataLayout if compatible with the CodeGen for this target.
///
/// The LLVM Module owns a DataLayout that is used for the target independent
/// optimizations and code generation. This hook provides a target specific
/// check on the validity of this DataLayout.
bool isCompatibleDataLayout(const DataLayout &Candidate) const {
return DL == Candidate;
}

/// Get the pointer size for this target.
///
/// This is the only time the DataLayout in the TargetMachine is used.
Expand Down
5 changes: 5 additions & 0 deletions lib/CodeGen/MachineFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,

FunctionNumber = FunctionNum;
JumpTableInfo = nullptr;

assert(TM.isCompatibleDataLayout(getDataLayout()) &&
"Can't create a MachineFunction using a Module with a "
"Target-incompatible DataLayout attached\n");

PSVManager = llvm::make_unique<PseudoSourceValueManager>();
}

Expand Down

0 comments on commit 378e97e

Please sign in to comment.