diff options
author | Duncan Sands <baldrick@free.fr> | 2012-06-15 08:37:50 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-06-15 08:37:50 +0000 |
commit | cd117f736c47947af5c6549734549e135e626c5c (patch) | |
tree | ee5a57234130b7d7203e0262193a0ba113d6733e /test | |
parent | 8e58b3e9b875c70e09d97d449373744aacc35ea9 (diff) | |
download | external_llvm-cd117f736c47947af5c6549734549e135e626c5c.zip external_llvm-cd117f736c47947af5c6549734549e135e626c5c.tar.gz external_llvm-cd117f736c47947af5c6549734549e135e626c5c.tar.bz2 |
Fix issues (infinite loop and/or crash) with self-referential instructions, for
example degenerate phi nodes and binops that use themselves in unreachable code.
Thanks to Charles Davis for the testcase that uncovered this can of worms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/Reassociate/crash.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/crash.ll b/test/Transforms/Reassociate/crash.ll index 601b976..bbe4f23 100644 --- a/test/Transforms/Reassociate/crash.ll +++ b/test/Transforms/Reassociate/crash.ll @@ -83,3 +83,28 @@ define i128 @foo() { %mul = mul i128 0, 0 ret i128 %mul } + +define void @infinite_loop() { +entry: + br label %loop +loop: + %x = phi i32 [undef, %entry], [%x, %loop] + %dead = add i32 %x, 0 + br label %loop +unreachable1: + %y1 = add i32 %y1, 0 + %z1 = add i32 %y1, 0 + ret void +unreachable2: + %y2 = add i32 %y2, 0 + %z2 = add i32 %y2, %y2 + ret void +unreachable3: + %y3 = add i32 %y3, %y3 + %z3 = add i32 %y3, 0 + ret void +unreachable4: + %y4 = add i32 %y4, %y4 + %z4 = add i32 %y4, %y4 + ret void +} |