Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Check if the parent basic block and caller exists before calling CS.getCaller when constant folding strip.invariant.group instrinsic. This avoids a crash when the function containing the intrinsic is being inlined. The instruction is checked for any simplifiction but has not yet been added to a basic block. Reviewers: Prazek, rsmith, efriedma Reviewed By: efriedma Subscribers: eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D49690 llvm-svn: 337742
- Loading branch information
Showing
2 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; RUN: opt < %s -inline -S | FileCheck %s | ||
|
||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
define i8* @callee() alwaysinline { | ||
; CHECK-LABEL: define i8* @callee() | ||
%1 = call i8* @llvm.strip.invariant.group.p0i8(i8* null) | ||
ret i8* %1 | ||
} | ||
|
||
define i8* @caller() { | ||
; CHECK-LABEL: define i8* @caller() | ||
; CHECK-NEXT: call i8* @llvm.strip.invariant.group.p0i8(i8* null) | ||
%1 = call i8* @callee() | ||
ret i8* %1 | ||
} | ||
|
||
declare i8* @llvm.strip.invariant.group.p0i8(i8*) |