Allow getting the base pointer of an image load/store.
authorSteven Perron <stevenperron@google.com>
Thu, 4 Jan 2018 16:37:19 +0000 (11:37 -0500)
committerDavid Neto <dneto@google.com>
Fri, 5 Jan 2018 18:26:10 +0000 (13:26 -0500)
commitccb921dd2bc6dd03a719725114022e4bfc596a1c
tree21f62f556fe7194856dba00a38e1fd1099f10e57
parent716718a5e969f6b4e73cbc864db59a754a83aab3
Allow getting the base pointer of an image load/store.

In value numbering, we treat loads and stores of images, ie OpImageLoad,
as a memory operation where it is interested in the "base address" of
the instruction.  In those cases, it is an image instruction.

The problem is that `Instruction::GetBaseAddress()` does not account for
the image instructions, so the assert at the end to make sure it found
a valid base address for its addressing mode fails.

The solution is to look at the load/store instruction to determine how
the assertion should be done.

Fixes #1160.
source/opt/instruction.cpp
source/opt/instruction.h
test/opt/instruction_test.cpp