mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang. llvm-svn: 90099
This commit is contained in:
parent
d9780ec7c5
commit
116b145b02
@ -564,6 +564,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant *const *Ops, unsigned NumOps,
|
||||
// we eliminate over-indexing of the notional static type array bounds.
|
||||
// This makes it easy to determine if the getelementptr is "inbounds".
|
||||
// Also, this helps GlobalOpt do SROA on GlobalVariables.
|
||||
Ptr = cast<Constant>(Ptr->stripPointerCasts());
|
||||
const Type *Ty = Ptr->getType();
|
||||
SmallVector<Constant*, 32> NewIdxs;
|
||||
do {
|
||||
|
@ -445,7 +445,7 @@ define i32 @test35() nounwind {
|
||||
i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind
|
||||
ret i32 0
|
||||
; CHECK: @test35
|
||||
; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* bitcast (i8** getelementptr (%t1* bitcast (%t0* @s to %t1*), i64 1, i32 0) to i8*)) nounwind
|
||||
; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0* @s, i64 0, i32 1, i64 0)) nounwind
|
||||
}
|
||||
|
||||
; Instcombine should constant-fold the GEP so that indices that have
|
||||
|
Loading…
Reference in New Issue
Block a user