Skip to content

Commit a383969

Browse files
committed
Revert 393daca "[ARM] Enable TypePromotion by default"
This caused "Too many bits for uint64_t" asserts when building Chromium. See https://crbug.com/1031978#c2 for a reproducer. I'll follow up on the llvm-commits thread with a creduced version. > ARMCodeGenPrepare has already been generalized and renamed to > TypePromotion. We've had it enabled and tested downstream for a > while, so enable it by default. > > Differential Revision: https://reviews.llvm.org/D70998
1 parent cafc741 commit a383969

File tree

11 files changed

+13
-31
lines changed

11 files changed

+13
-31
lines changed

llvm/lib/CodeGen/TypePromotion.cpp

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
using namespace llvm;
4646

4747
static cl::opt<bool>
48-
DisablePromotion("disable-type-promotion", cl::Hidden, cl::init(false),
48+
DisablePromotion("disable-type-promotion", cl::Hidden, cl::init(true),
4949
cl::desc("Disable type promotion pass"));
5050

5151
// The goal of this pass is to enable more efficient code generation for
@@ -899,34 +899,16 @@ bool TypePromotion::TryToPromote(Value *V, unsigned PromotedWidth) {
899899
for (auto *I : CurrentVisited)
900900
I->dump();
901901
);
902-
903-
// Check that promoting this at the IR level is most likely beneficial. It's
904-
// more likely if we're operating over multiple blocks and handling wrapping
905-
// instructions.
906902
unsigned ToPromote = 0;
907-
unsigned NonFreeArgs = 0;
908-
SmallPtrSet<BasicBlock*, 4> Blocks;
909903
for (auto *V : CurrentVisited) {
910-
if (auto *I = dyn_cast<Instruction>(V))
911-
Blocks.insert(I->getParent());
912-
913-
if (Sources.count(V)) {
914-
if (auto *Arg = dyn_cast<Argument>(V)) {
915-
if (!Arg->hasZExtAttr() && !Arg->hasSExtAttr())
916-
++NonFreeArgs;
917-
}
904+
if (Sources.count(V))
918905
continue;
919-
}
920-
921906
if (Sinks.count(cast<Instruction>(V)))
922907
continue;
923-
924908
++ToPromote;
925909
}
926910

927-
// DAG optimisations should be able to handle these cases better, especially
928-
// for function arguments.
929-
if (ToPromote < 2 || (Blocks.size() == 1 && (NonFreeArgs > SafeWrap.size())))
911+
if (ToPromote < 2)
930912
return false;
931913

932914
Promoter->Mutate(OrigTy, PromotedWidth, CurrentVisited, Sources, Sinks,

llvm/test/Transforms/TypePromotion/ARM/calls.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define i8 @call_with_imms(i8* %arg) {
55
; CHECK-LABEL: @call_with_imms(

llvm/test/Transforms/TypePromotion/ARM/casts.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define i16 @dsp_trunc(i32 %arg0, i32 %arg1, i16* %gep0, i16* %gep1) {
55
; CHECK-LABEL: @dsp_trunc(

llvm/test/Transforms/TypePromotion/ARM/clear-structures.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define i32 @clear_structures(i8* nocapture readonly %fmt, [1 x i32] %ap.coerce, i8* %out, void (i32, i8*)* nocapture %write) {
55
; CHECK-LABEL: @clear_structures(

llvm/test/Transforms/TypePromotion/ARM/icmps.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define i32 @test_ult_254_inc_imm(i8 zeroext %x) {
55
; CHECK-LABEL: @test_ult_254_inc_imm(

llvm/test/Transforms/TypePromotion/ARM/phis-ret.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
; Check that the arguments are extended but then nothing else is.
55
; This also ensures that the pass can handle loops.

llvm/test/Transforms/TypePromotion/ARM/pointers.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define void @phi_pointers(i16* %a, i16* %b, i8 zeroext %M, i8 zeroext %N) {
55
; CHECK-LABEL: @phi_pointers(

llvm/test/Transforms/TypePromotion/ARM/signed-icmps.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define i8 @eq_sgt(i8* %x, i8 *%y, i8 zeroext %z) {
55
; CHECK-LABEL: @eq_sgt(

llvm/test/Transforms/TypePromotion/ARM/signed.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
; Test to check that ARMCodeGenPrepare doesn't optimised away sign extends.
55
define i16 @test_signed_load(i16* %ptr) {

llvm/test/Transforms/TypePromotion/ARM/switch.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2-
; RUN: opt -mtriple=arm -type-promotion -verify -S %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=arm -type-promotion -verify -disable-type-promotion=false -S %s -o - | FileCheck %s
33

44
define void @truncate_source_phi_switch(i8* %memblock, i8* %store, i16 %arg) {
55
; CHECK-LABEL: @truncate_source_phi_switch(

0 commit comments

Comments
 (0)