nir/algebraic: Don't put quotes around floating point literals
The quotation marks around 1.0 cause it to be treated as a string
instead of a floating point value. The generator then treats it as an
arbitrary variable replacement, so any iand involving a ('ineg', ('b2i',
a)) matches.
v2: Remove misleading comment about sized literals (suggested by
Timothy). Add assertion that the name of a varible is entierly
alphabetic (suggested by Jason).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Timothy Arceri <tarceri@itsqueeze.com> [v1]
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> [v1]
Fixes: 6bcd2af086 ("nir/algebraic: Add some optimizations for D3D-style Booleans")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109075
This commit is contained in:
@@ -252,6 +252,14 @@ class Variable(Value):
|
||||
assert m and m.group('name') is not None
|
||||
|
||||
self.var_name = m.group('name')
|
||||
|
||||
# Prevent common cases where someone puts quotes around a literal
|
||||
# constant. If we want to support names that have numeric or
|
||||
# punctuation characters, we can me the first assertion more flexible.
|
||||
assert self.var_name.isalpha()
|
||||
assert self.var_name is not 'True'
|
||||
assert self.var_name is not 'False'
|
||||
|
||||
self.is_constant = m.group('const') is not None
|
||||
self.cond = m.group('cond')
|
||||
self.required_type = m.group('type')
|
||||
|
||||
Reference in New Issue
Block a user