aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-26 01:09:19 +0000
committerChris Lattner <sabre@nondot.org>2008-01-26 01:09:19 +0000
commit4a7c84596446d1027621302b1e5b616943a1d034 (patch)
tree7a5d62eac2a0a292784fc5d738aaff1ee206f391 /test/CodeGen
parent8aa8a5ed27e9146cb3e601a9cdf0ed481893116d (diff)
downloadexternal_llvm-4a7c84596446d1027621302b1e5b616943a1d034.zip
external_llvm-4a7c84596446d1027621302b1e5b616943a1d034.tar.gz
external_llvm-4a7c84596446d1027621302b1e5b616943a1d034.tar.bz2
Fix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to
delete a node even if it was not dead in some cases. Instead, just add it to the worklist. Also, make sure to use the CombineTo methods, as it was doing things that were unsafe: the top level combine loop could touch dangling memory. This fixes CodeGen/Generic/2008-01-25-dag-combine-mul.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/Generic/2008-01-25-dag-combine-mul.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/Generic/2008-01-25-dag-combine-mul.ll b/test/CodeGen/Generic/2008-01-25-dag-combine-mul.ll
new file mode 100644
index 0000000..4b25444
--- /dev/null
+++ b/test/CodeGen/Generic/2008-01-25-dag-combine-mul.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | llc
+; rdar://5707064
+
+define i32 @f(i16* %pc) {
+entry:
+ %acc = alloca i64, align 8 ; <i64*> [#uses=4]
+ %tmp97 = load i64* %acc, align 8 ; <i64> [#uses=1]
+ %tmp98 = and i64 %tmp97, 4294967295 ; <i64> [#uses=1]
+ %tmp99 = load i64* null, align 8 ; <i64> [#uses=1]
+ %tmp100 = and i64 %tmp99, 4294967295 ; <i64> [#uses=1]
+ %tmp101 = mul i64 %tmp98, %tmp100 ; <i64> [#uses=1]
+ %tmp103 = lshr i64 %tmp101, 0 ; <i64> [#uses=1]
+ %tmp104 = load i64* %acc, align 8 ; <i64> [#uses=1]
+ %.cast105 = zext i32 32 to i64 ; <i64> [#uses=1]
+ %tmp106 = lshr i64 %tmp104, %.cast105 ; <i64> [#uses=1]
+ %tmp107 = load i64* null, align 8 ; <i64> [#uses=1]
+ %tmp108 = and i64 %tmp107, 4294967295 ; <i64> [#uses=1]
+ %tmp109 = mul i64 %tmp106, %tmp108 ; <i64> [#uses=1]
+ %tmp112 = add i64 %tmp109, 0 ; <i64> [#uses=1]
+ %tmp116 = add i64 %tmp112, 0 ; <i64> [#uses=1]
+ %tmp117 = add i64 %tmp103, %tmp116 ; <i64> [#uses=1]
+ %tmp118 = load i64* %acc, align 8 ; <i64> [#uses=1]
+ %tmp120 = lshr i64 %tmp118, 0 ; <i64> [#uses=1]
+ %tmp121 = load i64* null, align 8 ; <i64> [#uses=1]
+ %tmp123 = lshr i64 %tmp121, 0 ; <i64> [#uses=1]
+ %tmp124 = mul i64 %tmp120, %tmp123 ; <i64> [#uses=1]
+ %tmp126 = shl i64 %tmp124, 0 ; <i64> [#uses=1]
+ %tmp127 = add i64 %tmp117, %tmp126 ; <i64> [#uses=1]
+ store i64 %tmp127, i64* %acc, align 8
+ ret i32 0
+}