@@ -45,7 +45,7 @@ enum ConstValue {
45
45
}
46
46
47
47
impl < ' a , ' tcx > Builder < ' a , ' tcx > {
48
- fn try_get_const_int_value ( & self , val : SpirvValue ) -> Option < ConstValue > {
48
+ fn try_get_const_value ( & self , val : SpirvValue ) -> Option < ConstValue > {
49
49
if let Some ( const_val) = self . builder . lookup_const ( val) {
50
50
let x = match const_val {
51
51
SpirvConst :: Scalar ( x) => x,
@@ -88,8 +88,8 @@ macro_rules! simple_op {
88
88
assert_ty_eq!( self , lhs. ty, rhs. ty) ;
89
89
let result_type = lhs. ty;
90
90
91
- $( if let Some ( const_lhs) = self . try_get_const_int_value ( lhs) {
92
- if let Some ( const_rhs) = self . try_get_const_int_value ( rhs) {
91
+ $( if let Some ( const_lhs) = self . try_get_const_value ( lhs) {
92
+ if let Some ( const_rhs) = self . try_get_const_value ( rhs) {
93
93
#[ allow( unreachable_patterns) ]
94
94
match ( const_lhs, const_rhs) {
95
95
$(
@@ -152,8 +152,8 @@ macro_rules! simple_shift_op {
152
152
fn $func_name( & mut self , lhs: Self :: Value , rhs: Self :: Value ) -> Self :: Value {
153
153
let result_type = lhs. ty;
154
154
155
- $( if let Some ( const_lhs) = self . try_get_const_int_value ( lhs) {
156
- if let Some ( const_rhs) = self . try_get_const_int_value ( rhs) {
155
+ $( if let Some ( const_lhs) = self . try_get_const_value ( lhs) {
156
+ if let Some ( const_rhs) = self . try_get_const_value ( rhs) {
157
157
#[ allow( unreachable_patterns) ]
158
158
match ( const_lhs, const_rhs) {
159
159
$(
@@ -219,7 +219,7 @@ macro_rules! simple_uni_op {
219
219
220
220
$(
221
221
#[ allow( unreachable_patterns, clippy:: collapsible_match) ]
222
- if let Some ( const_val) = self . try_get_const_int_value ( val) {
222
+ if let Some ( const_val) = self . try_get_const_value ( val) {
223
223
match const_val {
224
224
$(
225
225
ConstValue :: Unsigned ( $int_val) => return self . const_uint_big( result_type, $fold_int) ,
@@ -2612,8 +2612,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
2612
2612
assert_ty_eq ! ( self , lhs. ty, rhs. ty) ;
2613
2613
let b = SpirvType :: Bool . def ( self . span ( ) , self ) ;
2614
2614
2615
- if let Some ( const_lhs) = self . try_get_const_int_value ( lhs) {
2616
- if let Some ( const_rhs) = self . try_get_const_int_value ( rhs) {
2615
+ if let Some ( const_lhs) = self . try_get_const_value ( lhs) {
2616
+ if let Some ( const_rhs) = self . try_get_const_value ( rhs) {
2617
2617
let const_result = match self . lookup_type ( lhs. ty ) {
2618
2618
SpirvType :: Integer ( _, _) => match ( const_lhs, const_rhs, op) {
2619
2619
( ConstValue :: Unsigned ( lhs) , ConstValue :: Unsigned ( rhs) , IntEQ ) => {
@@ -3072,7 +3072,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
3072
3072
assert_ty_eq ! ( self , then_val. ty, else_val. ty) ;
3073
3073
let result_type = then_val. ty ;
3074
3074
3075
- if let Some ( const_cond) = self . try_get_const_int_value ( cond) {
3075
+ if let Some ( const_cond) = self . try_get_const_value ( cond) {
3076
3076
if let ConstValue :: Bool ( b) = const_cond {
3077
3077
// as we directly return the values, it'll preserve their constness as well
3078
3078
return if b { then_val } else { else_val } ;
0 commit comments