diff mbox

sparse, llvm: 'Verify' the LLVM module before writing it

Message ID 1345337422-22094-1-git-send-email-j.neuschaefer@gmx.net (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

J. Neuschäfer Aug. 19, 2012, 12:50 a.m. UTC
In later versions sparse-llvm should stop on wrong llvm code, instead
of outputting it, but for now there are too many warnings being produced
for this to be feasible (I think).

Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 sparse-llvm.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Pekka Enberg Aug. 19, 2012, 9:14 a.m. UTC | #1
On Sun, Aug 19, 2012 at 3:50 AM, Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:
> In later versions sparse-llvm should stop on wrong llvm code, instead
> of outputting it, but for now there are too many warnings being produced
> for this to be feasible (I think).
>
> Cc: Pekka Enberg <penberg@kernel.org>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Applied to 'llvm/core' branch:

https://github.com/penberg/sparse-llvm/commits/llvm/core

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 5bcc758..e02e212 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -5,6 +5,7 @@ 
 
 #include <llvm-c/Core.h>
 #include <llvm-c/BitWriter.h>
+#include <llvm-c/Analysis.h>
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -1253,6 +1254,8 @@  int main(int argc, char **argv)
 		compile(module, sparse(file));
 	} END_FOR_EACH_PTR_NOTAG(file);
 
+	LLVMVerifyModule(module, LLVMPrintMessageAction, NULL);
+
 	LLVMWriteBitcodeToFD(module, STDOUT_FILENO, 0, 0);
 
 	LLVMDisposeModule(module);