summaryrefslogtreecommitdiff
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-02-07 09:21:52 +0000
committerDuncan Sands <baldrick@free.fr>2011-02-07 09:21:52 +0000
commit1dbf0df996bba398a70abccc714b1a9652330014 (patch)
treee792d57266d40f929d2c7b3935dd110103f5c3f4 /include/llvm/Support
parentcf9efa59668a0c0fe4b2d856f16fc322cdcd8e07 (diff)
downloadllvm-1dbf0df996bba398a70abccc714b1a9652330014.tar.gz
llvm-1dbf0df996bba398a70abccc714b1a9652330014.tar.bz2
llvm-1dbf0df996bba398a70abccc714b1a9652330014.tar.xz
Add IRBuilder methods for creating an exact udiv, like for exact sdiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/ConstantFolder.h3
-rw-r--r--include/llvm/Support/IRBuilder.h6
-rw-r--r--include/llvm/Support/NoFolder.h3
-rw-r--r--include/llvm/Support/TargetFolder.h3
4 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/Support/ConstantFolder.h b/include/llvm/Support/ConstantFolder.h
index ea6c5fd82a..93adb3a403 100644
--- a/include/llvm/Support/ConstantFolder.h
+++ b/include/llvm/Support/ConstantFolder.h
@@ -72,6 +72,9 @@ public:
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getUDiv(LHS, RHS);
}
+ Constant *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
+ return ConstantExpr::getExactUDiv(LHS, RHS);
+ }
Constant *CreateSDiv(Constant *LHS, Constant *RHS) const {
return ConstantExpr::getSDiv(LHS, RHS);
}
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index e6c3cd8905..981a92ab3e 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -527,6 +527,12 @@ public:
return Insert(Folder.CreateUDiv(LC, RC), Name);
return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name);
}
+ Value *CreateExactUDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
+ if (Constant *LC = dyn_cast<Constant>(LHS))
+ if (Constant *RC = dyn_cast<Constant>(RHS))
+ return Insert(Folder.CreateExactUDiv(LC, RC), Name);
+ return Insert(BinaryOperator::CreateExactUDiv(LHS, RHS), Name);
+ }
Value *CreateSDiv(Value *LHS, Value *RHS, const Twine &Name = "") {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
diff --git a/include/llvm/Support/NoFolder.h b/include/llvm/Support/NoFolder.h
index 37ad27fe4b..d7b5b42924 100644
--- a/include/llvm/Support/NoFolder.h
+++ b/include/llvm/Support/NoFolder.h
@@ -77,6 +77,9 @@ public:
Instruction *CreateUDiv(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateUDiv(LHS, RHS);
}
+ Instruction *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
+ return BinaryOperator::CreateExactUDiv(LHS, RHS);
+ }
Instruction *CreateSDiv(Constant *LHS, Constant *RHS) const {
return BinaryOperator::CreateSDiv(LHS, RHS);
}
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h
index d34f35fe0d..138885d48d 100644
--- a/include/llvm/Support/TargetFolder.h
+++ b/include/llvm/Support/TargetFolder.h
@@ -85,6 +85,9 @@ public:
Constant *CreateUDiv(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getUDiv(LHS, RHS));
}
+ Constant *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
+ return Fold(ConstantExpr::getExactUDiv(LHS, RHS));
+ }
Constant *CreateSDiv(Constant *LHS, Constant *RHS) const {
return Fold(ConstantExpr::getSDiv(LHS, RHS));
}