mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
d433cf7463
Stop folding constant adds into GEP when the type size doesn't match. Otherwise, the adds' operands are effectively being promoted, changing the conditions of an overflow. Results are different when: sext(a) + sext(b) != sext(a + b) Problem originally found on x86-64, but also fixed issues with ARM and PPC, which used similar code. <rdar://problem/15292280> Patch by Duncan Exon Smith! llvm-svn: 194840
19 lines
519 B
LLVM
19 lines
519 B
LLVM
; fastisel should not fold add with non-pointer bitwidth
|
|
; sext(a) + sext(b) != sext(a + b)
|
|
; RUN: llc -mtriple=armv7-apple-ios %s -O0 -o - | FileCheck %s
|
|
|
|
define zeroext i8 @gep_promotion(i8* %ptr) nounwind uwtable ssp {
|
|
entry:
|
|
%ptr.addr = alloca i8*, align 8
|
|
%add = add i8 64, 64 ; 0x40 + 0x40
|
|
%0 = load i8** %ptr.addr, align 8
|
|
|
|
; CHECK-LABEL: _gep_promotion:
|
|
; CHECK: ldrb {{r[0-9]+}}, {{\[r[0-9]+\]}}
|
|
%arrayidx = getelementptr inbounds i8* %0, i8 %add
|
|
|
|
%1 = load i8* %arrayidx, align 1
|
|
ret i8 %1
|
|
}
|
|
|