[PATCH] Fix for crash during SjLj preparation step

Bill Wendling isanbard at gmail.com
Wed Jul 9 00:51:28 PDT 2014


>>! In D4256#10, @vhbit wrote:
> Still need advice if it is possible to unify both aggregate type branches into one, as I'm not sure if there is a combination of codegen/optimization flags which might not eliminate loading from null.

If there is a combination of flags that will result in a load from 'null', then it's a bug and will need to be fixed. The best way to guard against something like this is to create tests to make sure that the expected ASM is emitted.

I would modify the test you added here so that it checks for the expected ARM ASM once it runs through llc. Also, expand the testcase a bit, adding optimizations, etc. You won't be able to check all combinations of flags, nor should you need to. But at least check at every llc '-O' level.

================
Comment at: test/CodeGen/Thumb/sjljehprepare-lower-empty-struct.ll:1
@@ +1,2 @@
+; RUN: llc -mtriple=thumbv7-apple-ios < %s
+; SjLjEHPrepare shouldn't crash when lowering empty structs.
----------------
Please put this in test/CodeGen/ARM. It's not thumb-specific.

================
Comment at: test/CodeGen/Thumb/sjljehprepare-lower-empty-struct.ll:5
@@ +4,3 @@
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios"
+
----------------
I don't think you need the 'target *' lines here.

================
Comment at: test/CodeGen/Thumb/sjljehprepare-lower-empty-struct.ll:7
@@ +6,3 @@
+
+define i8* @foo(i32 %d, {} %c) {
+entry:
----------------
The arguments aren't used in the code. Could you modify the testcase so that they are used outside of the entry basic block?

http://reviews.llvm.org/D4256






More information about the llvm-commits mailing list