Skip to content

Commit b8dcb5f

Browse files
committed
nit fixes
1 parent 85ce594 commit b8dcb5f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
7676
"$res = builder.Create" # instName #
7777
"($lhs, $rhs, /*Name=*/\"\", op.hasNoUnsignedWrap(), op.hasNoSignedWrap());";
7878
}
79-
class LLVM_IntArithmeticOpWithIsExact<string mnemonic, string instName,
79+
class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
8080
list<Trait> traits = []> :
8181
LLVM_ArithmeticOpBase<AnySignlessInteger, mnemonic, instName,
8282
!listconcat([DeclareOpInterfaceMethods<ExactFlagInterface>], traits)> {
@@ -134,8 +134,8 @@ def LLVM_AddOp : LLVM_IntArithmeticOpWithOverflowFlag<"add", "Add",
134134
def LLVM_SubOp : LLVM_IntArithmeticOpWithOverflowFlag<"sub", "Sub", []>;
135135
def LLVM_MulOp : LLVM_IntArithmeticOpWithOverflowFlag<"mul", "Mul",
136136
[Commutative]>;
137-
def LLVM_UDivOp : LLVM_IntArithmeticOpWithIsExact<"udiv", "UDiv">;
138-
def LLVM_SDivOp : LLVM_IntArithmeticOpWithIsExact<"sdiv", "SDiv">;
137+
def LLVM_UDivOp : LLVM_IntArithmeticOpWithExactFlag<"udiv", "UDiv">;
138+
def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv">;
139139
def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem">;
140140
def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem">;
141141
def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And">;
@@ -146,8 +146,8 @@ def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor">;
146146
def LLVM_ShlOp : LLVM_IntArithmeticOpWithOverflowFlag<"shl", "Shl", []> {
147147
let hasFolder = 1;
148148
}
149-
def LLVM_LShrOp : LLVM_IntArithmeticOpWithIsExact<"lshr", "LShr">;
150-
def LLVM_AShrOp : LLVM_IntArithmeticOpWithIsExact<"ashr", "AShr">;
149+
def LLVM_LShrOp : LLVM_IntArithmeticOpWithExactFlag<"lshr", "LShr">;
150+
def LLVM_AShrOp : LLVM_IntArithmeticOpWithExactFlag<"ashr", "AShr">;
151151

152152
// Base class for compare operations. A compare operation takes two operands
153153
// of the same type and returns a boolean result. If the operands are

mlir/lib/Target/LLVMIR/ModuleImport.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,7 @@ void ModuleImport::setIntegerOverflowFlags(llvm::Instruction *inst,
686686
void ModuleImport::setExactFlag(llvm::Instruction *inst, Operation *op) const {
687687
auto iface = cast<ExactFlagInterface>(op);
688688

689-
bool value = inst->isExact();
690-
691-
iface.setIsExact(value);
689+
iface.setIsExact(inst->isExact());
692690
}
693691

694692
void ModuleImport::setFastmathFlagsAttr(llvm::Instruction *inst,

mlir/test/Dialect/LLVMIR/roundtrip.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func.func @ops(%arg0: i32, %arg1: f32,
4949
%mul_flag = llvm.mul %arg0, %arg0 overflow<nsw, nuw> : i32
5050
%shl_flag = llvm.shl %arg0, %arg0 overflow<nuw, nsw> : i32
5151

52-
// Integer exact
52+
// Integer exact flag.
5353
// CHECK: {{.*}} = llvm.sdiv exact %[[I32]], %[[I32]] : i32
5454
// CHECK: {{.*}} = llvm.udiv exact %[[I32]], %[[I32]] : i32
5555
// CHECK: {{.*}} = llvm.ashr exact %[[I32]], %[[I32]] : i32

0 commit comments

Comments
 (0)