diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 30da863b411..a5b0511fd98 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -114,6 +114,9 @@ static cl::opt OptLevelO3("O3", cl::desc("Optimization level 3. Similar to llvm-gcc -O3")); +static cl::opt +TargetTriple("mtriple", cl::desc("Override target triple for module")); + static cl::opt UnitAtATime("funit-at-a-time", cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"), @@ -512,6 +515,10 @@ int main(int argc, char **argv) { return 1; } + // If we are supposed to override the target triple, do so now. + if (!TargetTriple.empty()) + M->setTargetTriple(Triple::normalize(TargetTriple)); + // Figure out what stream we are supposed to write to... OwningPtr Out; if (NoOutput) {