From 5d335559b95065960ca5a5737216a031655a02a9 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Sat, 10 Sep 2016 18:14:57 +0000 Subject: InstCombine: Don't combine loads/stores from swifterror to a new type This generates invalid IR: the only users of swifterror can be call arguments, loads, and stores. rdar://28242257 llvm-svn: 281144 --- llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/Transforms/InstCombine') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 16032780142..8295899251a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -465,6 +465,10 @@ static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) { if (LI.use_empty()) return nullptr; + // swifterror values can't be bitcasted. + if (LI.getPointerOperand()->isSwiftError()) + return nullptr; + Type *Ty = LI.getType(); const DataLayout &DL = IC.getDataLayout(); @@ -997,6 +1001,10 @@ static bool combineStoreToValueType(InstCombiner &IC, StoreInst &SI) { if (!SI.isUnordered()) return false; + // swifterror values can't be bitcasted. + if (SI.getPointerOperand()->isSwiftError()) + return false; + Value *V = SI.getValueOperand(); // Fold away bit casts of the stored value by storing the original type. -- cgit v1.2.3