[llvm] r254956 - Remove useless hack that avoids calling LLVMLinkInInterpreter()

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 14:27:19 PST 2015


Author: mehdi_amini
Date: Mon Dec  7 16:27:19 2015
New Revision: 254956

URL: http://llvm.org/viewvc/llvm-project?rev=254956&view=rev
Log:
Remove useless hack that avoids calling LLVMLinkInInterpreter()

This is supposed to force-link the Interpreter, by inserting a dead
call to LLVMLinkInInterpreter().
Since it is actually an empty function, there is no reason for the
call to be dead.

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h?rev=254956&r1=254955&r2=254956&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h Mon Dec  7 16:27:19 2015
@@ -16,22 +16,12 @@
 #define LLVM_EXECUTIONENGINE_INTERPRETER_H
 
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include <cstdlib>
 
 extern "C" void LLVMLinkInInterpreter();
 
 namespace {
   struct ForceInterpreterLinking {
-    ForceInterpreterLinking() {
-      // We must reference the interpreter in such a way that compilers will not
-      // delete it all as dead code, even with whole program optimization,
-      // yet is effectively a NO-OP. As the compiler isn't smart enough
-      // to know that getenv() never returns -1, this will do the job.
-      if (std::getenv("bar") != (char*) -1)
-        return;
-
-      LLVMLinkInInterpreter();
-    }
+    ForceInterpreterLinking() { LLVMLinkInInterpreter(); }
   } ForceInterpreterLinking;
 }
 




More information about the llvm-commits mailing list