projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57329ca
)
[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)
author
Nikita Popov
<npopov@redhat.com>
Mon, 24 Jul 2023 14:57:57 +0000
(16:57 +0200)
committer
Nikita Popov
<npopov@redhat.com>
Mon, 24 Jul 2023 15:00:38 +0000
(17:00 +0200)
Constant folding cannot fail here, because we're really working
on plain integers. It might be better to make all of this work
on APInts instead of Constants.
llvm/lib/Analysis/ConstantFolding.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Analysis/ConstantFolding.cpp
b/llvm/lib/Analysis/ConstantFolding.cpp
index
08c60b4
..
fbc6275
100644
(file)
--- a/
llvm/lib/Analysis/ConstantFolding.cpp
+++ b/
llvm/lib/Analysis/ConstantFolding.cpp
@@
-235,7
+235,8
@@
Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) {
ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;
// Mix it in.
- Elt = ConstantExpr::getOr(Elt, Src);
+ Elt = ConstantFoldBinaryOpOperands(Instruction::Or, Elt, Src, DL);
+ assert(Elt && "Constant folding cannot fail on plain integers");
}
Result.push_back(Elt);
}