bool ContainsDynamicAllocas;
/// All cloned call sites that have operand bundles attached are appended to
- /// this vector. This vector may contain nulls if some of the originally
- /// inserted callsites were DCE'ed after they were cloned.
+ /// this vector. This vector may contain nulls or undefs if some of the
+ /// originally inserted callsites were DCE'ed after they were cloned.
std::vector<WeakVH> OperandBundleCallSites;
ClonedCodeInfo() : ContainsCalls(false), ContainsDynamicAllocas(false) {}
SmallVector<OperandBundleDef, 2> OpDefs;
for (auto &VH : InlinedFunctionInfo.OperandBundleCallSites) {
- if (!VH) continue; // instruction was DCE'd after being cloned
-
- Instruction *I = cast<Instruction>(VH);
+ Instruction *I = dyn_cast_or_null<Instruction>(VH);
+ if (!I) continue; // instruction was DCE'd or RAUW'ed to undef
OpDefs.clear();
ret i32 %x
}
+define i32 @callee_8(i1 %val) alwaysinline personality i8 3 {
+; We want something that PruningFunctionCloner is not smart enough to
+; recognize, but can be recognized by recursivelySimplifyInstruction.
+
+ entry:
+ br i1 %val, label %check, label %precheck
+
+ precheck:
+ br label %check
+
+ check:
+ %p = phi i1 [ %val, %entry ], [ true, %precheck ]
+ br i1 %p, label %do.not, label %do
+
+ do.not:
+ ret i32 0
+
+ do:
+ %phi = phi i32 [ 0, %check ], [ %v, %do ]
+ %v = call fastcc i32 @g.fastcc() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
+ %ic = icmp eq i32 %v, 42
+ br i1 %ic, label %do, label %done
+
+ done:
+ ret i32 %phi
+}
+
+define i32 @caller_8() {
+; CHECK-LABEL: @caller_8(
+ entry:
+; CHECK-NOT: call fastcc i32 @g.fastcc()
+; CHECK: ret i32 0
+ %x = call i32 @callee_8(i1 true) [ "deopt"(i32 7) ]
+ ret i32 %x
+}
+
attributes #0 = { "foo"="bar" }
; CHECK: attributes #[[FOO_BAR_ATTR_IDX]] = { "foo"="bar" }