[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.

Also clang-formats the patch, which I should have done the first time around.

llvm-svn: 327594
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index b7220db..f6e6ed6 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -67,7 +67,7 @@
   }
 
   ConstantInt *Priority = dyn_cast<ConstantInt>(CS->getOperand(0));
-  Value *Data = CS->getOperand(2);
+  Value *Data = CS->getNumOperands() == 3 ? CS->getOperand(2) : nullptr;
   return Element(Priority->getZExtValue(), Func, Data);
 }