[llvm] EarlyCSE: create casts on type-mismatch (PR #113339)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 08:13:06 PDT 2024
================
@@ -964,32 +965,42 @@ class EarlyCSE {
bool overridingStores(const ParseMemoryInst &Earlier,
const ParseMemoryInst &Later);
- Value *getOrCreateResult(Value *Inst, Type *ExpectedType) const {
- // TODO: We could insert relevant casts on type mismatch here.
- if (auto *LI = dyn_cast<LoadInst>(Inst))
- return LI->getType() == ExpectedType ? LI : nullptr;
- if (auto *SI = dyn_cast<StoreInst>(Inst)) {
- Value *V = SI->getValueOperand();
- return V->getType() == ExpectedType ? V : nullptr;
+ Value *getOrCreateResult(Instruction *Inst, Type *ExpectedType) const {
+ assert((isa<IntrinsicInst, LoadInst, StoreInst>(Inst)) &&
+ "Instruction not supported");
----------------
arsenm wrote:
Redundant with the casts below
https://github.com/llvm/llvm-project/pull/113339
More information about the llvm-commits
mailing list