Skip to content

Instantly share code, notes, and snippets.

@ramntry
Last active May 15, 2018 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramntry/3290e0bea953675b685801f71418da66 to your computer and use it in GitHub Desktop.
Save ramntry/3290e0bea953675b685801f71418da66 to your computer and use it in GitHub Desktop.
%dag = type { { { i8, { i8 } }, { { i8, { i8 } }, { i8 } } }, { { i8, { i8 } }, { i8 } } }
define void @test_const(%dag* %dst) {
entry:
%updated = insertvalue
; Check that we're visiting constants with shared parts
; (deduplicated via LLVMContext, forming a proper DAG) correctly:
%dag {
{ { i8, { i8 } }, { { i8, { i8 } }, { i8 } } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ { i8, { i8 } }, { i8 } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ i8 } { i8 20 }
}
},
{ { i8, { i8 } }, { i8 } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ i8 } { i8 20 }
}
},
{ { i8, { i8 } }, { i8 } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ i8 } { i8 50 }
},
0,
1
store %dag %updated, %dag* %dst
; 10, 20, 10, 20, 50, 10, 20, 20 sequence is expected
store
; Check that we didn't overwrite a previously seen constant
; while processing an insertvalue into it:
%dag {
{ { i8, { i8 } }, { { i8, { i8 } }, { i8 } } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ { i8, { i8 } }, { i8 } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ i8 } { i8 20 }
}
},
{ { i8, { i8 } }, { i8 } } {
{ i8, { i8 } } {
i8 10,
{ i8 } { i8 20 }
},
{ i8 } { i8 20 }
}
},
%dag* %dst
; 10, 20, 10, 20, 20, 10, 20, 20 sequence is expected
ret void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment