File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2335,7 +2335,7 @@ ValueCategory MLIRScanner::VisitUnaryOperator(clang::UnaryOperator *U) {
2335
2335
}
2336
2336
sub.store (loc, builder, next);
2337
2337
return ValueCategory (
2338
- (U->getOpcode () == clang::UnaryOperator::Opcode::UO_PostInc ) ? prev
2338
+ (U->getOpcode () == clang::UnaryOperator::Opcode::UO_PostDec ) ? prev
2339
2339
: next,
2340
2340
/* isReference*/ false );
2341
2341
}
Original file line number Diff line number Diff line change
1
+ // RUN: cgeist %s --function=* -S | FileCheck %s
2
+
3
+ int prefix_decrement (int x )
4
+ {
5
+ return -- x ;
6
+ }
7
+
8
+ int postfix_decrement (int x )
9
+ {
10
+ return x -- ;
11
+ }
12
+
13
+ // CHECK: func.func @prefix_decrement(%[[arg0:.+]]: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} {
14
+ // CHECK-NEXT: %[[c1_i32:.+]] = arith.constant -1 : i32
15
+ // CHECK-NEXT: %[[V0:.+]] = arith.addi %[[arg0]], %[[c1_i32]] : i32
16
+ // CHECK-NEXT: return %[[V0]] : i32
17
+ // CHECK-NEXT: }
18
+
19
+ // CHECK: func.func @postfix_decrement(%[[arg0:.+]]: i32) -> i32 attributes {llvm.linkage = #llvm.linkage<external>} {
20
+ // CHECK-NEXT: return %[[arg0]] : i32
21
+ // CHECK-NEXT: }
You can’t perform that action at this time.
0 commit comments