summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-01-05 03:22:33 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-01-05 03:22:33 +0000
commitb54a0ac20ac76f845026eab8fca112d1d40927de (patch)
treeb514003a548093e3017c1af741c0111b91c46765 /include
parent62107b62682ecdb4f03c1d773523754e9ac8188c (diff)
downloadllvm-b54a0ac20ac76f845026eab8fca112d1d40927de.tar.gz
llvm-b54a0ac20ac76f845026eab8fca112d1d40927de.tar.bz2
llvm-b54a0ac20ac76f845026eab8fca112d1d40927de.tar.xz
Fix a bug in IRBuilder that's been there for who knows how long. It
failed to correctly propagate the NUW and NSW flags to the constant folder for two instructions. I've added a unittest to cover flag propagation for the rest of the instructions and constant expressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/IRBuilder.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h
index c9c11be89d..617f40de8f 100644
--- a/include/llvm/IR/IRBuilder.h
+++ b/include/llvm/IR/IRBuilder.h
@@ -638,7 +638,7 @@ public:
bool HasNUW = false, bool HasNSW = false) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
- return Insert(Folder.CreateSub(LC, RC), Name);
+ return Insert(Folder.CreateSub(LC, RC, HasNUW, HasNSW), Name);
return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
HasNUW, HasNSW);
}
@@ -660,7 +660,7 @@ public:
bool HasNUW = false, bool HasNSW = false) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
- return Insert(Folder.CreateMul(LC, RC), Name);
+ return Insert(Folder.CreateMul(LC, RC, HasNUW, HasNSW), Name);
return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
HasNUW, HasNSW);
}