mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user